Skip to content

Commit

Permalink
Add tests for empty covers tag
Browse files Browse the repository at this point in the history
Fixes #15 (could not reproduce)
  • Loading branch information
oradwell committed May 8, 2018
1 parent 10190c8 commit af86682
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/Command/ValidateCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@ public function testReturnsFailForNonExistentClasses()
$this->assertRegExp('/There were 1 test\(s\) with invalid @covers tags./', $display);
}

public function testReturnsFailForEmptyCoversTag()
{
$app = new CoversValidator;
/** @var ValidateCommand $command */
$command = $app->find('validate');
$commandTester = new CommandTester($command);
$exitCode = $commandTester->execute(array(
'-c' => 'tests/Fixtures/configuration-emptycovers.xml'
));

$this->assertGreaterThan(0, $exitCode);
$display = $commandTester->getDisplay();
$this->assertRegExp('/Invalid - /', $display);
$this->assertRegExp('/There were 1 test\(s\) with invalid @covers tags./', $display);
}

public function testReturnsSuccessForExistingClasses()
{
$app = new CoversValidator;
Expand Down
14 changes: 14 additions & 0 deletions tests/Fixtures/OneTestCoversEmptyTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace OckCyp\CoversValidator\Tests\Fixtures;

class OneTestCoversEmptyTest extends \PHPUnit_Framework_TestCase
{
/**
* @covers
*/
public function testDummyTest()
{

}
}
8 changes: 8 additions & 0 deletions tests/Fixtures/configuration-emptycovers.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?>
<phpunit>
<testsuites>
<testsuite name="My Test Suite">
<file>./OneTestCoversEmptyTest.php</file>
</testsuite>
</testsuites>
</phpunit>

0 comments on commit af86682

Please sign in to comment.