From af86682f37e6b6f85aed7045e772beddba28f187 Mon Sep 17 00:00:00 2001 From: Oliver Radwell Date: Tue, 8 May 2018 20:47:42 +0100 Subject: [PATCH] Add tests for empty covers tag Fixes #15 (could not reproduce) --- tests/Command/ValidateCommandTest.php | 16 ++++++++++++++++ tests/Fixtures/OneTestCoversEmptyTest.php | 14 ++++++++++++++ tests/Fixtures/configuration-emptycovers.xml | 8 ++++++++ 3 files changed, 38 insertions(+) create mode 100644 tests/Fixtures/OneTestCoversEmptyTest.php create mode 100644 tests/Fixtures/configuration-emptycovers.xml diff --git a/tests/Command/ValidateCommandTest.php b/tests/Command/ValidateCommandTest.php index 5399962..3e05c69 100644 --- a/tests/Command/ValidateCommandTest.php +++ b/tests/Command/ValidateCommandTest.php @@ -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; diff --git a/tests/Fixtures/OneTestCoversEmptyTest.php b/tests/Fixtures/OneTestCoversEmptyTest.php new file mode 100644 index 0000000..596aada --- /dev/null +++ b/tests/Fixtures/OneTestCoversEmptyTest.php @@ -0,0 +1,14 @@ + + + + + ./OneTestCoversEmptyTest.php + + +