title: Configuring multiple methods in PHPUnit mock objects
body: <p>I am trying to create a mock object in PHP and PHPUnit. So far, I have this:</p>
  
  <pre><code>$object = $this-&gt;getMock('object',
                           array('set_properties',
                                 'get_events'),
                           array(),
                           'object_test',
                           null);
  
  $object
      -&gt;expects($this-&gt;once())
      -&gt;method('get_events')
      -&gt;will($this-&gt;returnValue(array()));
  
  $mo = new multiple_object($object);
  </code></pre>
  
  <p>Ignoring my hideously ambiguous object names for the minute, I understand that what I've done is<br>
   - Created a mock object, with 2 methods to configure,<br>
   - Configured the 'get_events' method to return a blank array, and<br>
   - Dropped the mock into the constructor.  </p>
  
  <p>What I'd like to do now is configure the second method, but I can't find anything explaining how to do that. I want to do something like</p>
  
  <pre><code>$object
      -&gt;expects($this-&gt;once())
      -&gt;method('get_events')
      -&gt;will($this-&gt;returnValue(array()))
      -&gt;expects($this-&gt;once())
      -&gt;method('set_properties')
      -&gt;with($this-&gt;equalTo(array()))
  </code></pre>
  
  <p>or some such, but that doesn't work. How should I do that?</p>
  
  <p>Tangentially, does this indicate I've structured my code poorly, if I need to configured more than one method to test?</p>