title: PHPUnit : Assert a parameter when pass it to mock object
body: <p>For the code below,</p>
  
  <pre><code>$mockObject-&gt;expects($this-&gt;at(0))
             -&gt;method('search')
             -&gt;with($searchConfig)
             -&gt;will($this-&gt;returnValue([]));
  </code></pre>
  
  <p>This line will automatic make a assertensure that when it call method <code>search</code> it must contain <code>$searchConfig</code> parameters. In this case, we have to provide totally matched <code>$searchConfig</code> but sometime it is hard if it is an array or an object.</p>
  
  <p>Are there any possible way to let PHPUnit call to some specific method to assert that it contains arguments pass in a method as we want?</p>
  
  <p>For example, I may create closure function to assert as below instead of using <code>-&gt;with()</code> method</p>
  
  <pre><code>function ($config){
      $this-&gt;assertFalse(isset($config['shouldnothere']));
      $this-&gt;assertTrue($config['object']-&gt;isValidValue());
  }
  </code></pre>