<?php
use PHPUnit\Framework\TestCase;
class MockClassNameTest extends TestCase
{
public function testMockClassName() : void
{
$mock = $this->getMockBuilder('FooAbstract')
->setMockClassName('Foo')
->getMock();
$mock->expects($this->once())
->method('fooey')
->willReturn(2);
$foo = new Foo();
$this->assertInstanceOf('FooAbstract', $mock);
$this->assertInstanceOf('Foo', $mock);
$this->assertSame(2, $mock->fooey());
$this->assertInstanceOf('FooAbstract', $foo);
$this->assertInstanceOf('Foo', $foo);
$this->assertNull($foo->fooey());
}
}
abstract class FooAbstract
{
public function fooey()
{
return 1;
}
}