title: PHPUnit call to undefined method `Mock_x_::method()`
body: <p>I'm trying to create my first phpunit test and find myself needing to stub a method on an <code>IMailer</code> interface.</p>
  
  <pre><code>interface IMailer
  {
      public function send($to, $from, $cc, $subject, $body);
      public function sent();
  }
  
      $mailer = $this-&gt;getMockBuilder(
          'IMailer',
          array('send', 'sent'))-&gt;getMock();
  
      $mailer-&gt;method('send')-&gt;willRreturn(0);
  </code></pre>
  
  <p>However, I keep getting</p>
  
  <pre><code>PHP Fatal error: 
    Call to undefined method Mock_Mailer_13fc0a04::method()
    in ...Test.php on line 16
  </code></pre>
  
  <p>a <code>var_dump($mailer);</code> results in</p>
  
  <pre><code>class Mock_IMailer_4c3e02a7#215 (1) {
    private $__phpunit_invocationMocker =&gt;
    NULL
  }
  </code></pre>
  
  <p>Working with the <code>expect($this-&gt;any())</code> gives a dito error - it seems that the mocked object does not have any mock functionality...</p>
  
  <p>I'm running phpunit 3.7.28, and php 5.5.9, on an ubuntu box.</p>
  
  <p>How come?  How can I fix it?</p>