Testing an abstract class

With normal mocks it's possible to test functions with many dependencies. But in PHPUnit and mocks there is also a way to test abstract classes. We can use the PHPUnit_Framework_TestCase::getMockForAbstractClass() method for this:

class FancyThing extends PHPUnit_Framework_TestCase
{
    public function testAbstractThing()
    {
        $abstractThing = $this->getMockForAbstractClass('AbstractThing');
        $abstractThing->run();
        $this->assertTrue($abstractThing->fancyMethod());
    }
}