/** * @param string the class to mock * @param callable|null|void The build phase closure * @return mixed */ public function shmock($clazz, $closure = null) { if (!$closure) { $closure = function () { }; } return Shmock::create($this, $clazz, $closure); }
public function testShmockCannotMockStaticPrivateMethodsNormally() { $testCaseShmock = Shmock::create($this, '\\PHPUnit_Framework_TestCase', function ($mock) { $mock->shmock_class(function ($smock) { $smock->assertFalse(true); // this would normally cause the test to fail, this ensures that it normally would happen }); }); $foo = Shmock::create_class($testCaseShmock, '\\Shmock\\Shmock_Foo', function ($mock) { $mock->sBar()->return_value(2); }); $foo::sFoo(); }