/** * @param string the class to create a class mock of * @param callable|null|void The build phase closure * @return string the name of the mock class */ public function shmock_class($clazz, $closure = null) { if (!$closure) { $closure = function () { }; } return Shmock::create_class($this, $clazz, $closure); }
public function testShmockCanMockStaticPrivateMethodsWithEscapeFlag() { Shmock::$disable_strict_method_checks_for_static_methods = true; $foo = Shmock::create_class($this, '\\Shmock\\Shmock_Foo', function ($mock) { $mock->sBar()->return_value(2); }); Shmock::$disable_strict_method_checks_for_static_methods = false; $this->assertEquals($foo::sFoo(), 2); }