title: PHPUnit: How to check that an array has an object with a specific attribute?
body: <p>Say we have the following array, <code>$myArray</code>, to check as per var_export:</p>
  
  <pre class="lang-php prettyprint-override"><code>array (
    0 =&gt; AnObject::__set_state(array(
             'id' =&gt; 10,
             'name' =&gt; 'foo'
    )),
    1 =&gt; AnObject::__set_state(array(
             'id' =&gt; 23,
             'name' =&gt; 'bar'
    )),
    2 =&gt; AnObject::__set_state(array(
             'id' =&gt; 55,
             'name' =&gt; 'baz'
    )),
  )
  </code></pre>
  
  <p>The assertion should pass if this array contains an <code>AnObject</code> which has a name of <code>'bar'</code>.</p>
  
  <p>I know that if I knew the position of the <code>AnObject</code> value, I could use:</p>
  
  <pre class="lang-php prettyprint-override"><code>$this-&gt;assertAttributeSame('bar', 'name', $myArray[1]);
  </code></pre>
  
  <p>Is there some way to use <code>$this-&gt;assertThat()</code>, or another type of contains to check the entire array and return true of one of the objects has the attribute that matches?</p>