title: test if array contains value using PHPUnit
body: <p>I created this array of objects:</p>
  
  <pre><code>$ad_1 = new AdUnit(array('id' =&gt; '1', 'name' =&gt; 'Ad_1', 'description' =&gt; 'great ad', 'code' =&gt; 'alpha', 'widget_id' =&gt; '123'));
  $ad_2 = new AdUnit(array('id' =&gt; '2', 'name' =&gt; 'Ad_2', 'description' =&gt; 'good ad', 'code' =&gt; 'delta', 'widget_id' =&gt; '456'));
  $ad_3 = new AdUnit(array('id' =&gt; '3', 'name' =&gt; 'Ad_3', 'description' =&gt; 'bad ad', 'code' =&gt; 'sigma', 'widget_id' =&gt; '789'));
  $adUnitArr = array($ad_1, $ad_2, $ad_3);
  </code></pre>
  
  <p>and i want to check that a random ad i got from a function exists in the array. the code to get the ad looks like this:</p>
  
  <pre><code>        $fixture = new AdGroup();
  $fixture-&gt;setAds($adUnitArr);
  $randad = $fixture-&gt;getRandomAd();
  </code></pre>
  
  <p>now i want to check if the array contains the random ad i received, what i was able to do like this:</p>
  
  <pre><code>$this-&gt;assertEquals(in_array($randad, $adUnitArr), 1); //check if ad in array
  </code></pre>
  
  <p>but my question is, is there an assert or some other way to check this thing better than the way i did it?? i tried using <code>assertArrayHasKey</code> but i got the following error:</p>
  
  <pre><code>PHPUnit_Framework_Exception: Argument #1 (No Value) of PHPUnit_Framework_Assert::assertArrayHasKey() must be a integer or string
  </code></pre>
  
  <p>any idea please? thx</p>