diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionTranslationTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionTranslationTest.php index addbad2e0f40f6bd4bb84cc55e07f94990482877..34969ebd4d16f0797a87f24ec668ca64dcd21c40 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionTranslationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityRevisionTranslationTest.php @@ -161,7 +161,7 @@ public function testDefaultRevision() { } /** - * @covers \Drupal\Core\Entity\RevisionableInterface::setNewRevision + * @covers \Drupal\Core\Entity\ContentEntityBase::setNewRevision */ public function testSetNewRevision() { $user = $this->createUser(); diff --git a/core/tests/Drupal/Tests/Listeners/DrupalStandardsListenerTrait.php b/core/tests/Drupal/Tests/Listeners/DrupalStandardsListenerTrait.php index 3352d900b380da0e382e25cde7ec2c9df245ee00..84eaaced06df730e99342c1dc9ba73243c8a7b09 100644 --- a/core/tests/Drupal/Tests/Listeners/DrupalStandardsListenerTrait.php +++ b/core/tests/Drupal/Tests/Listeners/DrupalStandardsListenerTrait.php @@ -42,7 +42,7 @@ private function fail(TestCase $test, $message) { * TRUE if the class exists, FALSE otherwise. */ private function classExists($class) { - return class_exists($class, TRUE) || trait_exists($class, TRUE) || interface_exists($class, TRUE); + return class_exists($class, TRUE) || trait_exists($class, TRUE); } /** @@ -71,7 +71,10 @@ private function checkValidCoversForTest(TestCase $test) { $default_class = reset($annotations['class']['coversDefaultClass']); // Check whether the default class exists. $valid_default_class = $this->classExists($default_class); - if (!$valid_default_class) { + if (!$valid_default_class && interface_exists($default_class)) { + $this->fail($test, "@coversDefaultClass refers to an interface '$default_class' and those can not be tested."); + } + elseif (!$valid_default_class) { $this->fail($test, "@coversDefaultClass does not exist '$default_class'"); } } @@ -105,6 +108,9 @@ private function checkValidCoversForTest(TestCase $test) { $this->fail($test, "@covers invalid syntax: Needs '::' or class does not exist in $covers"); return; } + elseif (interface_exists($class)) { + $this->fail($test, "@covers refers to an interface '$class' and those can not be tested."); + } else { $this->fail($test, '@covers class does not exist ' . $class); return;