static public mock_class ( string $class ) : string | ||
$class | string | - The class to mock |
Résultat | string | - The class that acts as a Phockito mock of the passed class |
static function mock_class($class)
{
$mockClass = self::build_test_double(false, $class);
// If we've been given a type registrar, call it (we need to do this even if class exists, since PHPUnit resets globals, possibly de-registering between tests)
$type_registrar = self::$type_registrar;
if ($type_registrar) {
$type_registrar::register_double($mockClass, $class, self::$_is_interface[$class]);
}
return $mockClass;
}
function testCanCreateMockOfStatic() { $mock = Phockito::mock_class('PhockitoTest_FooIsStatic'); $this->assertNull($mock::Foo()); }