diff --git a/src/Command/ValidateCommand.php b/src/Command/ValidateCommand.php index 99c1f12..753f727 100644 --- a/src/Command/ValidateCommand.php +++ b/src/Command/ValidateCommand.php @@ -73,8 +73,8 @@ protected function execute(InputInterface $input, OutputInterface $output) } $testClass = get_class($suite); - $testMethod = $suite->getName(); - $testSignature = $testClass . '::' . $testMethod; + $testMethod = $suite->getName(false); + $testSignature = $testClass . '::' . $suite->getName(); if ($output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG) { $this->writeValidity($output, 'Validating ' . $testSignature . '...'); diff --git a/tests/Command/ValidateCommandTest.php b/tests/Command/ValidateCommandTest.php index 3e05c69..24f2999 100644 --- a/tests/Command/ValidateCommandTest.php +++ b/tests/Command/ValidateCommandTest.php @@ -95,6 +95,22 @@ public function testReturnsFailForEmptyCoversTag() $this->assertRegExp('/There were 1 test\(s\) with invalid @covers tags./', $display); } + public function testReturnsFailForInvalidCoversTagWithProvider() + { + $app = new CoversValidator; + /** @var ValidateCommand $command */ + $command = $app->find('validate'); + $commandTester = new CommandTester($command); + $exitCode = $commandTester->execute(array( + '-c' => 'tests/Fixtures/configuration-nonexistentprovider.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; @@ -116,6 +132,21 @@ public function testReturnsSuccessForExistingClasses() $this->assertRegExp('/Validating /', $display); } + public function testReturnsSuccessForValidCoversTagWithProvider() + { + $app = new CoversValidator; + /** @var ValidateCommand $command */ + $command = $app->find('validate'); + $commandTester = new CommandTester($command); + $exitCode = $commandTester->execute(array( + '-c' => 'tests/Fixtures/configuration-existingprovider.xml' + )); + + $this->assertSame(0, $exitCode); + $display = $commandTester->getDisplay(); + $this->assertRegExp('/Validation complete. All @covers tags are valid./', $display); + } + public function testReturnsFailForComboClasses() { $app = new CoversValidator; diff --git a/tests/Fixtures/OneTestWithProviderCoveringExistingClassTest.php b/tests/Fixtures/OneTestWithProviderCoveringExistingClassTest.php new file mode 100644 index 0000000..cf7051b --- /dev/null +++ b/tests/Fixtures/OneTestWithProviderCoveringExistingClassTest.php @@ -0,0 +1,20 @@ + + + + + ./OneTestWithProviderCoveringExistingClassTest.php + + + diff --git a/tests/Fixtures/configuration-nonexistentprovider.xml b/tests/Fixtures/configuration-nonexistentprovider.xml new file mode 100644 index 0000000..50bd1d5 --- /dev/null +++ b/tests/Fixtures/configuration-nonexistentprovider.xml @@ -0,0 +1,8 @@ + + + + + ./OneTestWithProviderCoveringNonExistentClassTest.php + + +