title: phpunit - Only mocking some methods in a class
body: <p>I have a class that has a single method I would like to mock, but I'm having trouble getting phpunit to cooperate.</p>
  
  <p>An example:</p>
  
  <pre><code>  /**
     * @test
     */
    public function mockTest() {
      $mock = $this-&gt;getMock('ApiMock', array ('search'));
      $mock-&gt;expects($this-&gt;once())
        -&gt;method('search');
  
      $mock-&gt;search('test');
      $mock-&gt;somethingElse('another test');
    }
  </code></pre>
  
  <p>With this class:</p>
  
  <pre><code>class ApiStub {
    public function search($var) {
      return $var;
    }
  
    public function somethingElse($var) {
      return $var;
    }
  }
  </code></pre>
  
  <p>Throws the following error:</p>
  
  <pre><code>PHP Fatal error:  Call to undefined method Mock_ApiMock_14fd352a::somethingElse()
  </code></pre>
  
  <p>I would like to be able to mock the search() function, but still have somethingElse() do it's usual things.</p>