What setMockClassName() can do for your PHPUnit mock object

Code
<?php

class MockClassNameTest extends PHPUnit_Framework_TestCase
{
    public function 
testMockClassName()
    {
        
$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;
    }
}
Result
Time: 291 ms, Memory: 10.00MB

OK (1 test, 0 assertions)
Used Versions
PHP 7.1, Zend 3.0, Symfony 3.2, Laravel 5.2, PHPUnit 5.6, Doctrine 2.6