コード例 #1
0
 public function testMockingClassMethod()
 {
     $this->initAspectMock();
     //$mock = \AspectMock\Test::double(MyClass::class, ['myClassMethod' => 'a']);
     $mock = \AspectMock\Test::double('MyClass', ['myClassMethod' => 'a']);
     //$mock = \AspectMock\Test::double('\MyClass', ['myClassMethod' => 'a']);
     $classMethodReturned = MyClass::myClassMethod();
     // Extra verification to see if the AspectMock double is actually being run yet:
     //$mock->verifyInvoked('myClassMethod');
     $this->assertEquals('a', $classMethodReturned);
 }