diff --git a/core/tests/Drupal/Tests/Listeners/DeprecationListener.php b/core/tests/Drupal/Tests/Listeners/DeprecationListener.php index b43c7d6..4185400 100644 --- a/core/tests/Drupal/Tests/Listeners/DeprecationListener.php +++ b/core/tests/Drupal/Tests/Listeners/DeprecationListener.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\Listeners; use PHPUnit\Framework\BaseTestListener; +use PHPUnit\Framework\Test; /** * Removes deprecations that we are yet to fix. @@ -16,7 +17,7 @@ class DeprecationListener extends BaseTestListener { /** * {@inheritdoc} */ - public function endTest(\PHPUnit_Framework_Test $test, $time) { + public function endTest(Test $test, $time) { // Need to edit the file of deprecations. if ($file = getenv('SYMFONY_DEPRECATIONS_SERIALIZE')) { $deprecations = file_get_contents($file); diff --git a/core/tests/Drupal/Tests/Listeners/DrupalComponentTestListener.php b/core/tests/Drupal/Tests/Listeners/DrupalComponentTestListener.php index c349677..2481a84 100644 --- a/core/tests/Drupal/Tests/Listeners/DrupalComponentTestListener.php +++ b/core/tests/Drupal/Tests/Listeners/DrupalComponentTestListener.php @@ -5,7 +5,10 @@ use Drupal\KernelTests\KernelTestBase;; use Drupal\Tests\BrowserTestBase;; use Drupal\Tests\UnitTestCase; +use PHPUnit\Framework\AssertionFailedError; use PHPUnit\Framework\BaseTestListener; +use PHPUnit\Framework\Test; + /** * Ensures that no component tests are extending a core test base class. @@ -15,10 +18,10 @@ class DrupalComponentTestListener extends BaseTestListener { /** * {@inheritdoc} */ - public function endTest(\PHPUnit_Framework_Test $test, $time) { + public function endTest(Test $test, $time) { if (substr($test->toString(), 0, 22) == 'Drupal\Tests\Component') { if ($test instanceof BrowserTestBase || $test instanceof KernelTestBase || $test instanceof UnitTestCase) { - $error = new \PHPUnit_Framework_AssertionFailedError('Component tests should not extend a core test base class.'); + $error = new AssertionFailedError('Component tests should not extend a core test base class.'); $test->getTestResultObject()->addFailure($test, $error, $time); } } diff --git a/core/tests/Drupal/Tests/Listeners/DrupalStandardsListener.php b/core/tests/Drupal/Tests/Listeners/DrupalStandardsListener.php index fd15f82..8e6692d 100644 --- a/core/tests/Drupal/Tests/Listeners/DrupalStandardsListener.php +++ b/core/tests/Drupal/Tests/Listeners/DrupalStandardsListener.php @@ -2,8 +2,11 @@ namespace Drupal\Tests\Listeners; +use PHPUnit\Framework\AssertionFailedError; use PHPUnit\Framework\BaseTestListener; +use PHPUnit\Framework\Test; use PHPUnit\Framework\TestCase; +use PHPUnit\Framework\TestSuite; /** * Listens for PHPUnit tests and fails those with invalid coverage annotations. @@ -24,7 +27,7 @@ class DrupalStandardsListener extends BaseTestListener { protected function fail(TestCase $test, $message) { // Add the report to the test's results. $message .= ': ' . get_class($test) . '::' . $test->getName(); - $fail = new \PHPUnit_Framework_AssertionFailedError($message); + $fail = new AssertionFailedError($message); $result = $test->getTestResultObject(); $result->addFailure($test, $fail, 0); } @@ -153,14 +156,14 @@ public function checkValidCoversForTest(TestCase $test) { * * @see http://symfony.com/doc/current/components/phpunit_bridge.html#mark-tests-as-legacy */ - public function endTest(\PHPUnit_Framework_Test $test, $time) { - // \PHPUnit_Framework_Test does not have any useful methods of its own for + public function endTest(Test $test, $time) { + // \PHPUnit\Framework\Test does not have any useful methods of its own for // our purpose, so we have to distinguish between the different known // subclasses. if ($test instanceof TestCase) { $this->checkValidCoversForTest($test); } - elseif ($test instanceof \PHPUnit_Framework_TestSuite) { + elseif ($test instanceof TestSuite) { foreach ($test->getGroupDetails() as $tests) { foreach ($tests as $test) { $this->endTest($test, $time);