示例#1
0
 public function testMockStaticMethod()
 {
     $classMock = new ClassMock(null, '\\MockaMocks\\AbstractClass');
     /** @var AbstractClass $className */
     $className = $classMock->getClassName();
     $this->assertSame('jar', $className::jar());
     $classMock->mockStaticMethod('jar')->set(function () {
         return 'foo';
     });
     $this->assertSame('foo', $className::jar());
     $classMock->mockStaticMethod('nonexistent')->set(function () {
         return 'bar';
     });
     $this->assertSame('bar', $className::nonexistent());
 }