'Hamcrest matching an object array containing a property with a substring value
I am wanting to Phockito (PHP version of Mockito) mock a specific journey with my function that takes an array as an argument...
How would I use Hamcrest matchers to specify just one of the properties of said array?
The function in question looks like this:
function getStuff($path) {
$arr = [
'requestUri' => self::BASE_URI . $path,
...
];
return doMoreStuff($arr);
}
I am wanting to specify a Phockito route for a doMoreStuff mock that uses a specific path within the requestUri property.
I have looked at using arrayContaining:
Phockito($myMock)->doMoreStuff(
arrayContaining(['requestUri' => containsString('some-path')])
)->returns('some value);
but this doesn't seem to work..
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
