I've mocked a few classes before, but this one has got me
namespace Test\Library;
class MockClassTest extends \PHPUnit_Framework_TestCase
{
public $test;
public function setUp() {
$this->test = $this->getMock('TestMockClass');
$this->test->expects($this->any())
->method('test')
->will($this->returnValue(null));
}
public function testMock() {
$result = $this->test->test();
}
}
namespace Test\Library;
class TestMockClass {
public function test() {}
}
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
Is this a PHPUnit bug or am I missing something?
I'm using PHP 5.5.3 and PHPUnit 3.7.27.
Update (Fixed): See answer below