@coversDefaultClass

@coversDefaultClass

The @coversDefaultClass annotation can be used to specify a default namespace or class name. That way long names don't need to be repeated for every @covers annotation. See Example B.1.

Example B.1: Using @coversDefaultClass to shorten annotations

<?php
use PHPUnit\Framework\TestCase;

/**
 * @coversDefaultClass \Foo\CoveredClass
 */
class CoversDefaultClassTest extends TestCase
{
    /**
     * @covers ::publicMethod
     */
    public function testSomething()
    {
        $o = new Foo\CoveredClass;
        $o->publicMethod();
    }
}
?>
doc_PHPUnit
2016-10-16 15:37:29
Comments
Leave a Comment

Please login to continue.