예제 #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();
 }