I want to have an mocked object in all my tests, so I try to create it in the setUpBeforeClass() method, but this method is static so getMockBuilder has to be called statically like this:
public static function setUpBeforeClass() {
self::mocked_object = self::getMockBuilder('MockedClass')
->disableOriginalConstructor()
->getMock();
}
The problem is that getMockBuilder cannot be called statically :
Argument 1 passed to PHPUnit_Framework_MockObject_MockBuilder::__construct() must be an instance of PHPUnit_Framework_TestCase, null given
Is there any chance to have the mocked object be built in the setUpBeforeClass method or do I have to build it every time before a test (in the public function setUp() method) ?