示例#1
0
文件: Shmockers.php 项目: box/shmock
 /**
  * @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);
 }
示例#2
0
文件: ShmockTest.php 项目: box/shmock
 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();
 }