title: Mocking a class in PHPUnit
body: <p>I've mocked a few classes before, but this one has got me</p>
  
  <pre><code>namespace Test\Library;
  class MockClassTest extends \PHPUnit_Framework_TestCase
  {
      public $test;
  
      public function setUp() {
          $this-&gt;test = $this-&gt;getMock('TestMockClass');
  
          $this-&gt;test-&gt;expects($this-&gt;any())
                     -&gt;method('test')
                     -&gt;will($this-&gt;returnValue(null));
      }
  
      public function testMock() {
          $result = $this-&gt;test-&gt;test();
      }
  }
  
  namespace Test\Library;
  class TestMockClass {
      public function test() {}
  } 
  </code></pre>
  
  <p>Looks simple enough, but running this test results in:
  PHP Fatal error:  Call to undefined method Mock_TestMockClass_ac1dda46::test() in /home/vagrant/projects/test/module/Application/test/Test/Library/MockClassTest.php</p>
  
  <p>Is this a PHPUnit bug or am I missing something?</p>
  
  <p>I'm using PHP 5.5.3 and PHPUnit 3.7.27.</p>
  
  <p>Update (Fixed): 
  See answer below</p>