Given a class name as a string, return a new class name as a string which acts as a mock
of the passed class name. Probably not useful by itself until we start supporting static method stubbing
static public mock_class ( string $class ) : string | ||
$class | string | - The class to mock |
return | string | - The class that acts as a Phockito mock of the passed class |
function testCanCreateMockOfStatic() { $mock = Phockito::mock_class('PhockitoTest_FooIsStatic'); $this->assertNull($mock::Foo()); }
function testImplementsInjectionOfAnInterfaceDouble() { global $_PSST_ALL_CLASSES; $class = Phockito::mock_class('PhockitoSilverStripeTest_Interface'); $this->assertTrue(array_key_exists($class, $_PSST_ALL_CLASSES['implementors']['PhockitoSilverStripeTest_Interface'])); }