Say we have the following array, $myArray, to check as per var_export:
array (
0 => AnObject::__set_state(array(
'id' => 10,
'name' => 'foo'
)),
1 => AnObject::__set_state(array(
'id' => 23,
'name' => 'bar'
)),
2 => AnObject::__set_state(array(
'id' => 55,
'name' => 'baz'
)),
)
The assertion should pass if this array contains an AnObject which has a name of 'bar'.
I know that if I knew the position of the AnObject value, I could use:
$this->assertAttributeSame('bar', 'name', $myArray[1]);
Is there some way to use $this->assertThat(), or another type of contains to check the entire array and return true of one of the objects has the attribute that matches?