diff --git a/core/composer.json b/core/composer.json index 4cdea59f3b892f0fe5f3569598f07db5a98fa592..0904a6fafda8930dd73956cb80c8e53dba58eefa 100644 --- a/core/composer.json +++ b/core/composer.json @@ -41,7 +41,7 @@ "jcalderonzumba/gastonjs": "~1.0.2", "jcalderonzumba/mink-phantomjs-driver": "~0.3.1", "mikey179/vfsStream": "~1.2", - "phpunit/phpunit": ">=4.8.28 <5", + "phpunit/phpunit": ">=4.8.35 <5", "symfony/browser-kit": ">=2.8.13 <3.0", "symfony/css-selector": "~2.8" }, diff --git a/core/modules/content_moderation/tests/src/Unit/ContentPreprocessTest.php b/core/modules/content_moderation/tests/src/Unit/ContentPreprocessTest.php index 5de0b2a977c6508a312077bb0369df099a554301..8084716346fbb874c4482978287c7654009bae4d 100644 --- a/core/modules/content_moderation/tests/src/Unit/ContentPreprocessTest.php +++ b/core/modules/content_moderation/tests/src/Unit/ContentPreprocessTest.php @@ -5,13 +5,14 @@ use Drupal\content_moderation\ContentPreprocess; use Drupal\Core\Routing\CurrentRouteMatch; use Drupal\node\Entity\Node; +use Drupal\Tests\UnitTestCase; /** * @coversDefaultClass \Drupal\content_moderation\ContentPreprocess * * @group content_moderation */ -class ContentPreprocessTest extends \PHPUnit_Framework_TestCase { +class ContentPreprocessTest extends UnitTestCase { /** * @covers ::isLatestVersionPage diff --git a/core/modules/content_moderation/tests/src/Unit/LatestRevisionCheckTest.php b/core/modules/content_moderation/tests/src/Unit/LatestRevisionCheckTest.php index 1f8838b7741dc0133c580b5a9a333375714209fd..412a0eacea3af974518931ead619f20bff940c49 100644 --- a/core/modules/content_moderation/tests/src/Unit/LatestRevisionCheckTest.php +++ b/core/modules/content_moderation/tests/src/Unit/LatestRevisionCheckTest.php @@ -9,13 +9,14 @@ use Drupal\node\Entity\Node; use Drupal\content_moderation\Access\LatestRevisionCheck; use Drupal\content_moderation\ModerationInformation; +use Drupal\Tests\UnitTestCase; use Symfony\Component\Routing\Route; /** * @coversDefaultClass \Drupal\content_moderation\Access\LatestRevisionCheck * @group content_moderation */ -class LatestRevisionCheckTest extends \PHPUnit_Framework_TestCase { +class LatestRevisionCheckTest extends UnitTestCase { /** * Test the access check of the LatestRevisionCheck service. diff --git a/core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php b/core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php index 8d319ef319a8a06111da51caf549a30ee0b0ab04..57fe761ce1edef36018e82d5ffe3361331a9490e 100644 --- a/core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php +++ b/core/modules/content_moderation/tests/src/Unit/ModerationInformationTest.php @@ -10,13 +10,14 @@ use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Session\AccountInterface; use Drupal\content_moderation\ModerationInformation; +use Drupal\Tests\UnitTestCase; use Drupal\workflows\WorkflowInterface; /** * @coversDefaultClass \Drupal\content_moderation\ModerationInformation * @group content_moderation */ -class ModerationInformationTest extends \PHPUnit_Framework_TestCase { +class ModerationInformationTest extends UnitTestCase { /** * Builds a mock user. diff --git a/core/modules/content_moderation/tests/src/Unit/StateTransitionValidationTest.php b/core/modules/content_moderation/tests/src/Unit/StateTransitionValidationTest.php index 6ab2ad9875f28ab6a9dcfc2ec5a6c54b2982f9e8..b7c3942d835c8776645596019d46df44e9935170 100644 --- a/core/modules/content_moderation/tests/src/Unit/StateTransitionValidationTest.php +++ b/core/modules/content_moderation/tests/src/Unit/StateTransitionValidationTest.php @@ -7,6 +7,7 @@ use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Session\AccountInterface; use Drupal\content_moderation\StateTransitionValidation; +use Drupal\Tests\UnitTestCase; use Drupal\workflows\Entity\Workflow; use Drupal\workflows\WorkflowTypeInterface; use Drupal\workflows\WorkflowTypeManager; @@ -16,7 +17,7 @@ * @coversDefaultClass \Drupal\content_moderation\StateTransitionValidation * @group content_moderation */ -class StateTransitionValidationTest extends \PHPUnit_Framework_TestCase { +class StateTransitionValidationTest extends UnitTestCase { /** * Verifies user-aware transition validation. diff --git a/core/modules/file/tests/src/Functional/FileFieldTestBase.php b/core/modules/file/tests/src/Functional/FileFieldTestBase.php index 9ed447aaf25e969eee31621e04e7f588791f8ed0..d6096874d68bd2f6549a56e80070f72bca83b2e0 100644 --- a/core/modules/file/tests/src/Functional/FileFieldTestBase.php +++ b/core/modules/file/tests/src/Functional/FileFieldTestBase.php @@ -259,7 +259,7 @@ public function replaceNodeFile($file, $field_name, $nid, $new_revision = TRUE) /** * Asserts that a file exists physically on disk. * - * Overrides PHPUnit_Framework_Assert::assertFileExists() to also work with + * Overrides PHPUnit\Framework\Assert::assertFileExists() to also work with * file entities. * * @param \Drupal\File\FileInterface|string $file @@ -286,7 +286,7 @@ public function assertFileEntryExists($file, $message = NULL) { /** * Asserts that a file does not exist on disk. * - * Overrides PHPUnit_Framework_Assert::assertFileExists() to also work with + * Overrides PHPUnit\Framework\Assert::assertFileExists() to also work with * file entities. * * @param \Drupal\File\FileInterface|string $file diff --git a/core/modules/migrate/tests/src/Unit/Event/EventBaseTest.php b/core/modules/migrate/tests/src/Unit/Event/EventBaseTest.php index 6a52ed6efe3ecd1b735ff3bd595ed9d310f70873..b712d318b26c5d41f4da5fcb17018181b09a3a21 100644 --- a/core/modules/migrate/tests/src/Unit/Event/EventBaseTest.php +++ b/core/modules/migrate/tests/src/Unit/Event/EventBaseTest.php @@ -3,12 +3,13 @@ namespace Drupal\Tests\migrate\Unit\Event; use Drupal\migrate\Event\EventBase; +use Drupal\Tests\UnitTestCase; /** * @coversDefaultClass \Drupal\migrate\Event\EventBase * @group migrate */ -class EventBaseTest extends \PHPUnit_Framework_TestCase { +class EventBaseTest extends UnitTestCase { /** * Test getMigration method. diff --git a/core/modules/migrate/tests/src/Unit/Event/MigrateImportEventTest.php b/core/modules/migrate/tests/src/Unit/Event/MigrateImportEventTest.php index 480fe85a704b45f2e24bd5eb7ddab0cb76cdf186..d281433e03d572d85053b3ee323ada0901a6d56a 100644 --- a/core/modules/migrate/tests/src/Unit/Event/MigrateImportEventTest.php +++ b/core/modules/migrate/tests/src/Unit/Event/MigrateImportEventTest.php @@ -3,12 +3,13 @@ namespace Drupal\Tests\migrate\Unit\Event; use Drupal\migrate\Event\MigrateImportEvent; +use Drupal\Tests\UnitTestCase; /** * @coversDefaultClass \Drupal\migrate\Event\MigrateImportEvent * @group migrate */ -class MigrateImportEventTest extends \PHPUnit_Framework_TestCase { +class MigrateImportEventTest extends UnitTestCase { /** * Test getMigration method. diff --git a/core/modules/serialization/tests/src/Unit/CompilerPass/RegisterSerializationClassesCompilerPassTest.php b/core/modules/serialization/tests/src/Unit/CompilerPass/RegisterSerializationClassesCompilerPassTest.php index 630535dea7a27578027c50d9c1525f4bc7f50dda..f9a5b7729806e30e91e5bf85340f54824d39fe8b 100644 --- a/core/modules/serialization/tests/src/Unit/CompilerPass/RegisterSerializationClassesCompilerPassTest.php +++ b/core/modules/serialization/tests/src/Unit/CompilerPass/RegisterSerializationClassesCompilerPassTest.php @@ -4,6 +4,7 @@ use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\serialization\RegisterSerializationClassesCompilerPass; +use Drupal\Tests\UnitTestCase; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\Serializer\Serializer; @@ -11,7 +12,7 @@ * @coversDefaultClass \Drupal\serialization\RegisterSerializationClassesCompilerPass * @group serialization */ -class RegisterSerializationClassesCompilerPassTest extends \PHPUnit_Framework_TestCase { +class RegisterSerializationClassesCompilerPassTest extends UnitTestCase { /** * @covers ::process diff --git a/core/modules/simpletest/simpletest.install b/core/modules/simpletest/simpletest.install index b6cfc80e100c204a4372b6fdecb5bf2cb2578359..530228834a973e1821de7b2d3f3b6eb2c52603c1 100644 --- a/core/modules/simpletest/simpletest.install +++ b/core/modules/simpletest/simpletest.install @@ -6,6 +6,7 @@ */ use Drupal\Component\Utility\Environment; +use PHPUnit\Framework\TestCase; /** * Minimum value of PHP memory_limit for SimpleTest. @@ -18,7 +19,7 @@ function simpletest_requirements($phase) { $requirements = []; - $has_phpunit = class_exists('\PHPUnit_Framework_TestCase'); + $has_phpunit = class_exists(TestCase::class); $has_curl = function_exists('curl_init'); $open_basedir = ini_get('open_basedir'); diff --git a/core/modules/simpletest/simpletest.module b/core/modules/simpletest/simpletest.module index 7d72aa44bcd55fa88bb096e5ec29da8356d07bfa..8b1cc2398bf4484dbef653074f05b703085e2752 100644 --- a/core/modules/simpletest/simpletest.module +++ b/core/modules/simpletest/simpletest.module @@ -13,6 +13,7 @@ use Drupal\Core\Test\TestDatabase; use Drupal\simpletest\TestDiscovery; use Drupal\Tests\Listeners\SimpletestUiPrinter; +use PHPUnit\Framework\TestCase; use Symfony\Component\Process\PhpExecutableFinder; use Drupal\Core\Test\TestStatus; @@ -412,7 +413,7 @@ function _simpletest_batch_operation($test_list_init, $test_id, &$context) { // Perform the next test. $test_class = array_shift($test_list); - if (is_subclass_of($test_class, \PHPUnit_Framework_TestCase::class)) { + if (is_subclass_of($test_class, TestCase::class)) { $phpunit_results = simpletest_run_phpunit_tests($test_id, [$test_class]); simpletest_process_phpunit_results($phpunit_results); $test_results[$test_class] = simpletest_summarize_phpunit_result($phpunit_results)[$test_class]; diff --git a/core/modules/simpletest/src/ContentTypeCreationTrait.php b/core/modules/simpletest/src/ContentTypeCreationTrait.php index 9ad0a21792153eec08d805811bcffe25fb58187d..ec15b9af77c95945cd4af3c5ca7559408faae9c8 100644 --- a/core/modules/simpletest/src/ContentTypeCreationTrait.php +++ b/core/modules/simpletest/src/ContentTypeCreationTrait.php @@ -4,6 +4,7 @@ use Drupal\Component\Render\FormattableMarkup; use Drupal\node\Entity\NodeType; +use PHPUnit\Framework\TestCase; /** * Provides methods to create content type from given values. @@ -40,7 +41,7 @@ protected function createContentType(array $values = []) { $status = $type->save(); node_add_body_field($type); - if ($this instanceof \PHPUnit_Framework_TestCase) { + if ($this instanceof TestCase) { $this->assertSame($status, SAVED_NEW, (new FormattableMarkup('Created content type %type.', ['%type' => $type->id()]))->__toString()); } else { diff --git a/core/modules/simpletest/tests/fixtures/simpletest_phpunit_run_command_test.php b/core/modules/simpletest/tests/fixtures/simpletest_phpunit_run_command_test.php index a4ffc7ae45a7ed482dd2015af171c14c05ff5f81..42dadfdb3620451343ce04e30da59173a53c61a3 100644 --- a/core/modules/simpletest/tests/fixtures/simpletest_phpunit_run_command_test.php +++ b/core/modules/simpletest/tests/fixtures/simpletest_phpunit_run_command_test.php @@ -2,6 +2,8 @@ namespace Drupal\Tests\simpletest\Unit; +use Drupal\Tests\UnitTestCase; + /** * This test crashes PHP. * @@ -11,7 +13,7 @@ * * @see \Drupal\Tests\simpletest\Unit\SimpletestPhpunitRunCommandTest::testSimpletestPhpUnitRunCommand() */ -class SimpletestPhpunitRunCommandTestWillDie extends \PHPUnit_Framework_TestCase { +class SimpletestPhpunitRunCommandTestWillDie extends UnitTestCase { /** * Performs the status specified by SimpletestPhpunitRunCommandTestWillDie. diff --git a/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php index a96db963c8a66273e18940db7106bb83a57788db..63fe1bb8a9278bf85efa90bd8bb83b146da8d944 100644 --- a/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php +++ b/core/modules/simpletest/tests/src/Unit/SimpletestPhpunitRunCommandTest.php @@ -4,15 +4,19 @@ use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\File\FileSystemInterface; +use PHPUnit\Framework\TestCase; /** * Tests simpletest_run_phpunit_tests() handles PHPunit fatals correctly. * + * We don't extend Drupal\Tests\UnitTestCase here because its $root property is + * not static and we need it to be static here. + * * @group simpletest * * @runTestsInSeparateProcesses */ -class SimpletestPhpunitRunCommandTest extends \PHPUnit_Framework_TestCase { +class SimpletestPhpunitRunCommandTest extends TestCase { /** * Path to the app root. diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh index 9e832a5bad0bd1a335e6c7680c26f27d03fcd434..714cf3c46cffbc069ae7d69fead8eef911e4c092 100755 --- a/core/scripts/run-tests.sh +++ b/core/scripts/run-tests.sh @@ -17,6 +17,7 @@ use Drupal\simpletest\Form\SimpletestResultsForm; use Drupal\simpletest\TestBase; use Drupal\simpletest\TestDiscovery; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; $autoloader = require_once __DIR__ . '/../../autoload.php'; @@ -36,7 +37,7 @@ const SIMPLETEST_SCRIPT_EXIT_FAILURE = 1; const SIMPLETEST_SCRIPT_EXIT_EXCEPTION = 2; -if (!class_exists('\PHPUnit_Framework_TestCase')) { +if (!class_exists(TestCase::class)) { echo "\nrun-tests.sh requires the PHPUnit testing framework. Please use 'composer install --dev' to ensure that it is present.\n\n"; exit(SIMPLETEST_SCRIPT_EXIT_FAILURE); } @@ -783,7 +784,7 @@ function simpletest_script_run_one_test($test_id, $test_class) { $methods = array(); } $test = new $class_name($test_id); - if (is_subclass_of($test_class, '\PHPUnit_Framework_TestCase')) { + if (is_subclass_of($test_class, TestCase::class)) { $status = simpletest_script_run_phpunit($test_id, $test_class); } else { @@ -865,7 +866,7 @@ function simpletest_script_command($test_id, $test_class) { * @see simpletest_script_run_one_test() */ function simpletest_script_cleanup($test_id, $test_class, $exitcode) { - if (is_subclass_of($test_class, '\PHPUnit_Framework_TestCase')) { + if (is_subclass_of($test_class, TestCase::class)) { // PHPUnit test, move on. return; } @@ -1020,7 +1021,7 @@ function simpletest_script_get_test_list() { else { foreach ($matches[1] as $class_name) { $namespace_class = $namespace . '\\' . $class_name; - if (is_subclass_of($namespace_class, '\Drupal\simpletest\TestBase') || is_subclass_of($namespace_class, '\PHPUnit_Framework_TestCase')) { + if (is_subclass_of($namespace_class, '\Drupal\simpletest\TestBase') || is_subclass_of($namespace_class, TestCase::class)) { $test_list[] = $namespace_class; } } @@ -1074,7 +1075,7 @@ function simpletest_script_get_test_list() { else { foreach ($matches[1] as $class_name) { $namespace_class = $namespace . '\\' . $class_name; - if (is_subclass_of($namespace_class, '\Drupal\simpletest\TestBase') || is_subclass_of($namespace_class, '\PHPUnit_Framework_TestCase')) { + if (is_subclass_of($namespace_class, '\Drupal\simpletest\TestBase') || is_subclass_of($namespace_class, TestCase::class)) { $test_list[] = $namespace_class; } } diff --git a/core/tests/Drupal/KernelTests/AssertLegacyTrait.php b/core/tests/Drupal/KernelTests/AssertLegacyTrait.php index 1d1816aa9c04a6b2d892bcd14eebdd99c7ae2595..f63c4bf0b694e68fe9498044f7994833c449a3dc 100644 --- a/core/tests/Drupal/KernelTests/AssertLegacyTrait.php +++ b/core/tests/Drupal/KernelTests/AssertLegacyTrait.php @@ -6,7 +6,7 @@ * Translates Simpletest assertion methods to PHPUnit. * * Protected methods are custom. Public static methods override methods of - * \PHPUnit_Framework_Assert. + * \PHPUnit\Framework\Assert. * * @deprecated Scheduled for removal in Drupal 9.0.0. Use PHPUnit's native * assert methods instead. diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php index 04926e03d0ea00c67ce1b4de22f61bdcc41086aa..7bbb77401660f0738b3d712cd94252b574537bfe 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBase.php +++ b/core/tests/Drupal/KernelTests/KernelTestBase.php @@ -22,6 +22,7 @@ use Drupal\Tests\ConfigTestTrait; use Drupal\Tests\RandomGeneratorTrait; use Drupal\simpletest\TestServiceProvider; +use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpFoundation\Request; use org\bovigo\vfs\vfsStream; @@ -49,7 +50,7 @@ * @todo Extend ::setRequirementsFromAnnotation() and ::checkRequirements() to * account for '@requires module'. */ -abstract class KernelTestBase extends \PHPUnit_Framework_TestCase implements ServiceProviderInterface { +abstract class KernelTestBase extends TestCase implements ServiceProviderInterface { use AssertLegacyTrait; use AssertContentTrait; diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php index 754f9d9838f04266848992d721fa47e73ba88b9b..5751368f615c1d906c005da607939652b83b92ba 100644 --- a/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/core/tests/Drupal/Tests/BrowserTestBase.php @@ -27,6 +27,7 @@ use Drupal\simpletest\BlockCreationTrait; use Drupal\simpletest\NodeCreationTrait; use Drupal\simpletest\UserCreationTrait; +use PHPUnit\Framework\TestCase; use Symfony\Component\CssSelector\CssSelectorConverter; use Symfony\Component\HttpFoundation\Request; use Psr\Http\Message\RequestInterface; @@ -41,7 +42,7 @@ * * @ingroup testing */ -abstract class BrowserTestBase extends \PHPUnit_Framework_TestCase { +abstract class BrowserTestBase extends TestCase { use FunctionalTestSetupTrait; use TestSetupTrait; diff --git a/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php b/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php index 1299cd642104c2fa40290a0507e5d685235c931c..208440be749656889b2c11fbc4f142c4cdb1c5fc 100644 --- a/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php +++ b/core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php @@ -7,14 +7,14 @@ namespace Drupal\Tests\Component\Assertion; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Drupal\Component\Assertion\Inspector; /** * @coversDefaultClass \Drupal\Component\Assertion\Inspector * @group Assertion */ -class InspectorTest extends PHPUnit_Framework_TestCase { +class InspectorTest extends TestCase { /** * Tests asserting argument is an array or traversable object. diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php index 6cd5575964f34c48a1338419b8f2fefc73a86fc7..cec466b9945a4ecd61c81cc8c513361387826665 100644 --- a/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php +++ b/core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php @@ -8,6 +8,7 @@ namespace Drupal\Tests\Component\DependencyInjection; use Drupal\Component\Utility\Crypt; +use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Exception\LogicException; @@ -21,7 +22,7 @@ * @coversDefaultClass \Drupal\Component\DependencyInjection\Container * @group DependencyInjection */ -class ContainerTest extends \PHPUnit_Framework_TestCase { +class ContainerTest extends TestCase { /** * The tested container. diff --git a/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php b/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php index 9da4c27bc16dc4404277906e67ca95b0b1c4e6dd..0a5d58be1927fac23f48ab32fe33abb672822459 100644 --- a/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php +++ b/core/tests/Drupal/Tests/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumperTest.php @@ -8,6 +8,7 @@ namespace Drupal\Tests\Component\DependencyInjection\Dumper { use Drupal\Component\Utility\Crypt; + use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Parameter; @@ -21,7 +22,7 @@ * @coversDefaultClass \Drupal\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumper * @group DependencyInjection */ - class OptimizedPhpArrayDumperTest extends \PHPUnit_Framework_TestCase { + class OptimizedPhpArrayDumperTest extends TestCase { /** * The container builder instance. diff --git a/core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php b/core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php index 70fb0dcf155a4266f502dac84234f1e2aca4bdcc..c5fab90921d0b90aa1e41c664919753d8a03ddfa 100644 --- a/core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php +++ b/core/tests/Drupal/Tests/Component/Diff/DiffFormatterTest.php @@ -4,6 +4,7 @@ use Drupal\Component\Diff\Diff; use Drupal\Component\Diff\DiffFormatter; +use PHPUnit\Framework\TestCase; /** * Test DiffFormatter classes. @@ -12,7 +13,7 @@ * * @group Diff */ -class DiffFormatterTest extends \PHPUnit_Framework_TestCase { +class DiffFormatterTest extends TestCase { /** * @return array diff --git a/core/tests/Drupal/Tests/Component/Diff/Engine/DiffEngineTest.php b/core/tests/Drupal/Tests/Component/Diff/Engine/DiffEngineTest.php index ade152751e748a50bca45bb54da709742af5d1fa..69f92daec9c79932f224b993f7e824a957839492 100644 --- a/core/tests/Drupal/Tests/Component/Diff/Engine/DiffEngineTest.php +++ b/core/tests/Drupal/Tests/Component/Diff/Engine/DiffEngineTest.php @@ -7,6 +7,7 @@ use Drupal\Component\Diff\Engine\DiffOpCopy; use Drupal\Component\Diff\Engine\DiffOpChange; use Drupal\Component\Diff\Engine\DiffOpDelete; +use PHPUnit\Framework\TestCase; /** * Test DiffEngine class. @@ -15,7 +16,7 @@ * * @group Diff */ -class DiffEngineTest extends \PHPUnit_Framework_TestCase { +class DiffEngineTest extends TestCase { /** * @return array diff --git a/core/tests/Drupal/Tests/Component/Diff/Engine/DiffOpTest.php b/core/tests/Drupal/Tests/Component/Diff/Engine/DiffOpTest.php index 4275bb7abf0eef29bc3ef2f5153b3ce1d6893b21..1a649ae510c7733dd7c65a647e517799a827b49e 100644 --- a/core/tests/Drupal/Tests/Component/Diff/Engine/DiffOpTest.php +++ b/core/tests/Drupal/Tests/Component/Diff/Engine/DiffOpTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\Component\Diff\Engine; use Drupal\Component\Diff\Engine\DiffOp; +use PHPUnit\Framework\TestCase; /** * Test DiffOp base class. @@ -15,7 +16,7 @@ * * @group Diff */ -class DiffOpTest extends \PHPUnit_Framework_TestCase { +class DiffOpTest extends TestCase { /** * DiffOp::reverse() always throws an error. diff --git a/core/tests/Drupal/Tests/Component/Diff/Engine/HWLDFWordAccumulatorTest.php b/core/tests/Drupal/Tests/Component/Diff/Engine/HWLDFWordAccumulatorTest.php index ccf468d348d605752cd879f15d50ba87370e7355..194f37f50eb4b4a046bca929e5faced48ed93743 100644 --- a/core/tests/Drupal/Tests/Component/Diff/Engine/HWLDFWordAccumulatorTest.php +++ b/core/tests/Drupal/Tests/Component/Diff/Engine/HWLDFWordAccumulatorTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\Component\Diff\Engine; use Drupal\Component\Diff\Engine\HWLDFWordAccumulator; +use PHPUnit\Framework\TestCase; /** * Test HWLDFWordAccumulator. @@ -11,7 +12,7 @@ * * @group Diff */ -class HWLDFWordAccumulatorTest extends \PHPUnit_Framework_TestCase { +class HWLDFWordAccumulatorTest extends TestCase { /** * Verify that we only get back a NBSP from an empty accumulator. diff --git a/core/tests/Drupal/Tests/Component/Serialization/YamlTestBase.php b/core/tests/Drupal/Tests/Component/Serialization/YamlTestBase.php index d2b504ecae0d461ad79cb83bb265637658ad3367..2f8f23e5b3c863fff54c1bb60ba58e053636cea1 100644 --- a/core/tests/Drupal/Tests/Component/Serialization/YamlTestBase.php +++ b/core/tests/Drupal/Tests/Component/Serialization/YamlTestBase.php @@ -2,10 +2,12 @@ namespace Drupal\Tests\Component\Serialization; +use PHPUnit\Framework\TestCase; + /** * Provides standard data to validate different YAML implementations. */ -abstract class YamlTestBase extends \PHPUnit_Framework_TestCase { +abstract class YamlTestBase extends TestCase { /** * Some data that should be able to be serialized. diff --git a/core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php b/core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php index b621b2dacacfb8d44b662583d77d900fc2983d51..9538bd2511268d068d530dbc91589a10346c7532 100644 --- a/core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php +++ b/core/tests/Drupal/Tests/Core/Cache/Context/SessionCacheContextTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\Core\Cache\Context; use Drupal\Core\Cache\Context\SessionCacheContext; +use Drupal\Tests\UnitTestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; @@ -10,7 +11,7 @@ * @coversDefaultClass \Drupal\Core\Cache\Context\SessionCacheContext * @group Cache */ -class SessionCacheContextTest extends \PHPUnit_Framework_TestCase { +class SessionCacheContextTest extends UnitTestCase { /** * The request stack. diff --git a/core/tests/Drupal/Tests/Core/Config/ConfigFactoryOverrideBaseTest.php b/core/tests/Drupal/Tests/Core/Config/ConfigFactoryOverrideBaseTest.php index 7386ac900b2da42fc39616495667fb4a7454069a..f81352f712dbc9e83236dd92ba344553861af61c 100644 --- a/core/tests/Drupal/Tests/Core/Config/ConfigFactoryOverrideBaseTest.php +++ b/core/tests/Drupal/Tests/Core/Config/ConfigFactoryOverrideBaseTest.php @@ -6,12 +6,13 @@ use Drupal\Core\Config\ConfigCrudEvent; use Drupal\Core\Config\ConfigFactoryOverrideBase; use Drupal\Core\Config\ConfigRenameEvent; +use Drupal\Tests\UnitTestCase; /** * @coversDefaultClass \Drupal\Core\Config\ConfigFactoryOverrideBase * @group config */ -class ConfigFactoryOverrideBaseTest extends \PHPUnit_Framework_TestCase { +class ConfigFactoryOverrideBaseTest extends UnitTestCase { /** * @dataProvider providerTestFilterNestedArray diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/AuthenticationProviderPassTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/AuthenticationProviderPassTest.php index 6f99d0985474c6cd2ff8c236dd4a6f0e438de682..9fe058a7900577c829cae094a808d1180519496d 100644 --- a/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/AuthenticationProviderPassTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/Compiler/AuthenticationProviderPassTest.php @@ -4,6 +4,7 @@ use Drupal\Core\DependencyInjection\Compiler\AuthenticationProviderPass; use Drupal\Core\DependencyInjection\ContainerBuilder; +use Drupal\Tests\UnitTestCase; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\Serializer\Serializer; @@ -11,7 +12,7 @@ * @coversDefaultClass \Drupal\Core\DependencyInjection\Compiler\AuthenticationProviderPass * @group DependencyInjection */ -class AuthenticationProviderPassTest extends \PHPUnit_Framework_TestCase { +class AuthenticationProviderPassTest extends UnitTestCase { /** * @covers ::process diff --git a/core/tests/Drupal/Tests/Core/DependencyInjection/YamlFileLoaderTest.php b/core/tests/Drupal/Tests/Core/DependencyInjection/YamlFileLoaderTest.php index 1a9dc667f71fce050d6753e8891e00d2c8c4839c..97b2c942d2c0e1b30f40d879993a48b6a41228f1 100644 --- a/core/tests/Drupal/Tests/Core/DependencyInjection/YamlFileLoaderTest.php +++ b/core/tests/Drupal/Tests/Core/DependencyInjection/YamlFileLoaderTest.php @@ -5,13 +5,14 @@ use Drupal\Component\FileCache\FileCacheFactory; use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\DependencyInjection\YamlFileLoader; +use Drupal\Tests\UnitTestCase; use org\bovigo\vfs\vfsStream; /** * @coversDefaultClass \Drupal\Core\DependencyInjection\YamlFileLoader * @group DependencyInjection */ -class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase { +class YamlFileLoaderTest extends UnitTestCase { /** * {@inheritdoc} diff --git a/core/tests/Drupal/Tests/Core/EventSubscriber/OptionsRequestSubscriberTest.php b/core/tests/Drupal/Tests/Core/EventSubscriber/OptionsRequestSubscriberTest.php index 46a331736b49a2de3c43a971d63f180f0bd2123e..e995616632de77aedec35c51d068d30d71553b2b 100644 --- a/core/tests/Drupal/Tests/Core/EventSubscriber/OptionsRequestSubscriberTest.php +++ b/core/tests/Drupal/Tests/Core/EventSubscriber/OptionsRequestSubscriberTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\Core\EventSubscriber; use Drupal\Core\EventSubscriber\OptionsRequestSubscriber; +use Drupal\Tests\UnitTestCase; use Symfony\Cmf\Component\Routing\RouteProviderInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Event\GetResponseEvent; @@ -14,7 +15,7 @@ * @coversDefaultClass \Drupal\Core\EventSubscriber\OptionsRequestSubscriber * @group EventSubscriber */ -class OptionsRequestSubscriberTest extends \PHPUnit_Framework_TestCase { +class OptionsRequestSubscriberTest extends UnitTestCase { /** * @covers ::onRequest diff --git a/core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php b/core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php index 1b72b75303b8a91a8ee5b5c67d851fd09f126fb4..8a7554dec903099e0a80bbc70f9e5973edc140b3 100644 --- a/core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php +++ b/core/tests/Drupal/Tests/Core/Routing/MethodFilterTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\Core\Routing; use Drupal\Core\Routing\MethodFilter; +use Drupal\Tests\UnitTestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Route; @@ -12,7 +13,7 @@ * @coversDefaultClass \Drupal\Core\Routing\MethodFilter * @group Routing */ -class MethodFilterTest extends \PHPUnit_Framework_TestCase { +class MethodFilterTest extends UnitTestCase { /** * @covers ::applies diff --git a/core/tests/Drupal/Tests/Listeners/DrupalStandardsListener.php b/core/tests/Drupal/Tests/Listeners/DrupalStandardsListener.php index 7f8396fe07f312ee742086b788aae9eac6c6ae35..fa2541886ef346edc73d463a91beeceec6bb7220 100644 --- a/core/tests/Drupal/Tests/Listeners/DrupalStandardsListener.php +++ b/core/tests/Drupal/Tests/Listeners/DrupalStandardsListener.php @@ -2,23 +2,26 @@ namespace Drupal\Tests\Listeners; +use PHPUnit\Framework\BaseTestListener; +use PHPUnit\Framework\TestCase; + /** * Listens for PHPUnit tests and fails those with invalid coverage annotations. * * Enforces various coding standards within test runs. */ -class DrupalStandardsListener extends \PHPUnit_Framework_BaseTestListener { +class DrupalStandardsListener extends BaseTestListener { /** * Signals a coding standards failure to the user. * - * @param \PHPUnit_Framework_TestCase $test + * @param \PHPUnit\Framework\TestCase $test * The test where we should insert our test failure. * @param string $message * The message to add to the failure notice. The test class name and test * name will be appended to this message automatically. */ - protected function fail(\PHPUnit_Framework_TestCase $test, $message) { + 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); @@ -44,10 +47,10 @@ protected function classExists($class) { * * This method is called from $this::endTest(). * - * @param \PHPUnit_Framework_TestCase $test + * @param \PHPUnit\Framework\TestCase $test * The test to examine. */ - public function checkValidCoversForTest(\PHPUnit_Framework_TestCase $test) { + public function checkValidCoversForTest(TestCase $test) { // If we're generating a coverage report already, don't do anything here. if ($test->getTestResultObject() && $test->getTestResultObject()->getCollectCodeCoverageInformation()) { return; @@ -144,7 +147,7 @@ public function endTest(\PHPUnit_Framework_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 \PHPUnit_Framework_TestCase) { + if ($test instanceof TestCase) { $this->checkValidCoversForTest($test); } elseif ($test instanceof \PHPUnit_Framework_TestSuite) { diff --git a/core/tests/Drupal/Tests/TestSuites/TestSuiteBaseTest.php b/core/tests/Drupal/Tests/TestSuites/TestSuiteBaseTest.php index 0ba8143427771652fb38cd46cf2b386c6c097b7a..5b1d546b51965846cefa84f5fda33adfcfc32e53 100644 --- a/core/tests/Drupal/Tests/TestSuites/TestSuiteBaseTest.php +++ b/core/tests/Drupal/Tests/TestSuites/TestSuiteBaseTest.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\TestSuites; use org\bovigo\vfs\vfsStream; +use PHPUnit\Framework\TestCase; // The test suite class is not part of the autoloader, we need to include it // manually. @@ -13,7 +14,7 @@ * * @group TestSuite */ -class TestSuiteBaseTest extends \PHPUnit_Framework_TestCase { +class TestSuiteBaseTest extends TestCase { /** * Helper method to set up the file system. diff --git a/core/tests/Drupal/Tests/UnitTestCase.php b/core/tests/Drupal/Tests/UnitTestCase.php index f96b5109e83ec38151f47b2bf25e31dfe133a1c1..8aaeb85743aa195bbc74512197c9af8f41fb2ac6 100644 --- a/core/tests/Drupal/Tests/UnitTestCase.php +++ b/core/tests/Drupal/Tests/UnitTestCase.php @@ -8,6 +8,7 @@ use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\StringTranslation\PluralTranslatableMarkup; +use PHPUnit\Framework\TestCase; /** @@ -15,7 +16,7 @@ * * @ingroup testing */ -abstract class UnitTestCase extends \PHPUnit_Framework_TestCase { +abstract class UnitTestCase extends TestCase { /** * The random generator.