Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHPUnit Placeholder for empty tests

I like to have empty functions on occasion for placeholders (primarily empty constructors, since it helps avoid accidental duplication of constructors since my team knows there must always be one somewhere).

I also like to have at least one test for every method of a class (largely because it is a nice easy rule to hold my team against).

My question is simple: what should we put in these empty test methods to prevent the "no tests" warning.

We could just do $this->assertTrue(true), which I know will work just fine. However, I was wondering if there was anything a touch more official and proper (preferably something which makes it so the method isn't counted in the number of tests run, artificially inflating it a bit).

Thanks.

like image 596
samanime Avatar asked Oct 25 '25 02:10

samanime


1 Answers

try this :

/**
 * @covers Controllers\AdminController::authenticate
 * @todo   Implement testAuthenticate().
 */
public function testAuthenticate()
{
    // Remove the following lines when you implement this test.
    $this->markTestIncomplete(
      'This test has not been implemented yet.'
    );
}
like image 99
mpm Avatar answered Oct 26 '25 16:10

mpm