diff --git a/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php b/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php index cf2df4afaf4..8b6327cadb7 100644 --- a/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php +++ b/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php @@ -205,7 +205,7 @@ class BigPipeTest extends BrowserTestBase { $this->assertNoRaw(BigPipe::STOP_SIGNAL, 'BigPipe stop signal absent: error occurred before then.'); $this->assertNoRaw('', 'Closing body tag absent: error occurred before then.'); // The exception is expected. Do not interpret it as a test failure. - unlink(\Drupal::root() . '/' . $this->siteDirectory . '/error.log'); + unlink($this->root . '/' . $this->siteDirectory . '/error.log'); } /** @@ -273,7 +273,7 @@ class BigPipeTest extends BrowserTestBase { $this->assertRaw('You are not allowed to say llamas are not cool!'); $this->assertNoRaw('', 'Closing body tag absent: error occurred before then.'); // The exception is expected. Do not interpret it as a test failure. - unlink(\Drupal::root() . '/' . $this->siteDirectory . '/error.log'); + unlink($this->root . '/' . $this->siteDirectory . '/error.log'); } /** diff --git a/core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php b/core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php index 34c241f3951..c40229fe7a9 100644 --- a/core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php +++ b/core/modules/field/tests/src/Kernel/FieldTypePluginManagerTest.php @@ -112,7 +112,7 @@ class FieldTypePluginManagerTest extends FieldKernelTestBase { * Enable all core modules. */ protected function enableAllCoreModules() { - $listing = new ExtensionDiscovery(\Drupal::root()); + $listing = new ExtensionDiscovery($this->root); $module_list = $listing->scan('module', FALSE); /** @var \Drupal\Core\Extension\ModuleHandlerInterface $module_handler */ $module_handler = $this->container->get('module_handler'); diff --git a/core/modules/file/tests/src/Kernel/Migrate/d6/FileMigrationTestTrait.php b/core/modules/file/tests/src/Kernel/Migrate/d6/FileMigrationTestTrait.php index 0aa4e194eec..1fc8a52be0e 100644 --- a/core/modules/file/tests/src/Kernel/Migrate/d6/FileMigrationTestTrait.php +++ b/core/modules/file/tests/src/Kernel/Migrate/d6/FileMigrationTestTrait.php @@ -30,7 +30,7 @@ trait FileMigrationTestTrait { // Make sure we have a single trailing slash. $source = $migration->getSourceConfiguration(); $source['site_path'] = 'core/modules/simpletest'; - $source['constants']['source_base_path'] = \Drupal::root() . '/'; + $source['constants']['source_base_path'] = $this->root . '/'; $migration->set('source', $source); } } diff --git a/core/modules/image/tests/src/Kernel/ImageItemTest.php b/core/modules/image/tests/src/Kernel/ImageItemTest.php index 45d9d0378a2..9621423823d 100644 --- a/core/modules/image/tests/src/Kernel/ImageItemTest.php +++ b/core/modules/image/tests/src/Kernel/ImageItemTest.php @@ -67,7 +67,7 @@ class ImageItemTest extends FieldKernelTestBase { 'file_extensions' => 'jpg', ], ])->save(); - file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', 'public://example.jpg'); + file_unmanaged_copy($this->root . '/core/misc/druplicon.png', 'public://example.jpg'); $this->image = File::create([ 'uri' => 'public://example.jpg', ]); @@ -100,7 +100,7 @@ class ImageItemTest extends FieldKernelTestBase { $this->assertEqual($entity->image_test->entity->uuid(), $this->image->uuid()); // Make sure the computed entity reflects updates to the referenced file. - file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', 'public://example-2.jpg'); + file_unmanaged_copy($this->root . '/core/misc/druplicon.png', 'public://example-2.jpg'); $image2 = File::create([ 'uri' => 'public://example-2.jpg', ]); diff --git a/core/modules/image/tests/src/Kernel/ImageThemeFunctionTest.php b/core/modules/image/tests/src/Kernel/ImageThemeFunctionTest.php index 0e6e3f2815b..bffd6545f6d 100644 --- a/core/modules/image/tests/src/Kernel/ImageThemeFunctionTest.php +++ b/core/modules/image/tests/src/Kernel/ImageThemeFunctionTest.php @@ -62,7 +62,7 @@ class ImageThemeFunctionTest extends KernelTestBase { 'field_name' => 'image_test', 'bundle' => 'entity_test', ])->save(); - file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', 'public://example.jpg'); + file_unmanaged_copy($this->root . '/core/misc/druplicon.png', 'public://example.jpg'); $this->image = File::create([ 'uri' => 'public://example.jpg', ]); diff --git a/core/modules/media/tests/src/Functional/MediaRevisionTest.php b/core/modules/media/tests/src/Functional/MediaRevisionTest.php index 001d59b07c9..1747d5dd787 100644 --- a/core/modules/media/tests/src/Functional/MediaRevisionTest.php +++ b/core/modules/media/tests/src/Functional/MediaRevisionTest.php @@ -135,7 +135,7 @@ class MediaRevisionTest extends MediaFunctionalTestBase { $this->drupalGet('/media/add/image'); $page = $this->getSession()->getPage(); $page->fillField('Name', 'Foobar'); - $page->attachFileToField('Image', \Drupal::root() . '/core/modules/media/tests/fixtures/example_1.jpeg'); + $page->attachFileToField('Image', $this->root . '/core/modules/media/tests/fixtures/example_1.jpeg'); $page->pressButton('Save'); $assert->addressMatches('/^\/media\/[0-9]+$/'); diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php index fd508cf0fd5..48b42916aa7 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php @@ -68,7 +68,7 @@ class MediaDisplayTest extends MediaJavascriptTestBase { $this->drupalGet('media/add/image'); $image_media_name = 'Fantastic image asset!'; $page->fillField('name[0][value]', $image_media_name); - $page->attachFileToField('files[field_media_image_0]', \Drupal::root() . '/core/modules/media/tests/fixtures/example_1.jpeg'); + $page->attachFileToField('files[field_media_image_0]', $this->root . '/core/modules/media/tests/fixtures/example_1.jpeg'); $result = $assert_session->waitForButton('Remove'); $this->assertNotEmpty($result); $page->fillField('field_media_image[0][alt]', 'Image Alt Text 1'); diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php index 708cec0bd40..2be4321bbb1 100644 --- a/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php +++ b/core/modules/media/tests/src/FunctionalJavascript/MediaSourceImageTest.php @@ -46,7 +46,7 @@ class MediaSourceImageTest extends MediaSourceTestBase { // Create a media item. $this->drupalGet("media/add/{$media_type_id}"); - $page->attachFileToField("files[{$source_field_id}_0]", \Drupal::root() . '/core/modules/media/tests/fixtures/example_1.jpeg'); + $page->attachFileToField("files[{$source_field_id}_0]", $this->root . '/core/modules/media/tests/fixtures/example_1.jpeg'); $result = $assert_session->waitForButton('Remove'); $this->assertNotEmpty($result); $page->fillField("{$source_field_id}[0][alt]", 'Image Alt Text 1'); diff --git a/core/modules/rdf/tests/src/Functional/StandardProfileTest.php b/core/modules/rdf/tests/src/Functional/StandardProfileTest.php index 8662b9daca5..6d953117406 100644 --- a/core/modules/rdf/tests/src/Functional/StandardProfileTest.php +++ b/core/modules/rdf/tests/src/Functional/StandardProfileTest.php @@ -136,7 +136,7 @@ class StandardProfileTest extends BrowserTestBase { $this->term->save(); // Create image. - file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', 'public://example.jpg'); + file_unmanaged_copy($this->root . '/core/misc/druplicon.png', 'public://example.jpg'); $this->image = File::create(['uri' => 'public://example.jpg']); $this->image->save(); diff --git a/core/modules/search/tests/src/Functional/SearchSimplifyTest.php b/core/modules/search/tests/src/Functional/SearchSimplifyTest.php index 399f4ba0d85..11220e25fdf 100644 --- a/core/modules/search/tests/src/Functional/SearchSimplifyTest.php +++ b/core/modules/search/tests/src/Functional/SearchSimplifyTest.php @@ -20,7 +20,7 @@ class SearchSimplifyTest extends SearchTestBase { // their own lines). So the even-numbered lines should simplify to nothing, // and the odd-numbered lines we need to split into shorter chunks and // verify that simplification doesn't lose any characters. - $input = file_get_contents(\Drupal::root() . '/core/modules/search/tests/UnicodeTest.txt'); + $input = file_get_contents($this->root . '/core/modules/search/tests/UnicodeTest.txt'); $basestrings = explode(chr(10), $input); $strings = []; foreach ($basestrings as $key => $string) { diff --git a/core/modules/system/tests/src/Functional/Common/EarlyRenderingControllerTest.php b/core/modules/system/tests/src/Functional/Common/EarlyRenderingControllerTest.php index 451cef911f7..9d6c0af5d10 100644 --- a/core/modules/system/tests/src/Functional/Common/EarlyRenderingControllerTest.php +++ b/core/modules/system/tests/src/Functional/Common/EarlyRenderingControllerTest.php @@ -104,7 +104,7 @@ class EarlyRenderingControllerTest extends BrowserTestBase { // The exceptions are expected. Do not interpret them as a test failure. // Not using File API; a potential error must trigger a PHP warning. - unlink(\Drupal::root() . '/' . $this->siteDirectory . '/error.log'); + unlink($this->root . '/' . $this->siteDirectory . '/error.log'); } } diff --git a/core/modules/system/tests/src/Functional/FileTransfer/FileTransferTest.php b/core/modules/system/tests/src/Functional/FileTransfer/FileTransferTest.php index a4fbb667bad..a15a92a6dbb 100644 --- a/core/modules/system/tests/src/Functional/FileTransfer/FileTransferTest.php +++ b/core/modules/system/tests/src/Functional/FileTransfer/FileTransferTest.php @@ -20,7 +20,7 @@ class FileTransferTest extends BrowserTestBase { protected function setUp() { parent::setUp(); - $this->testConnection = TestFileTransfer::factory(\Drupal::root(), ['hostname' => $this->hostname, 'username' => $this->username, 'password' => $this->password, 'port' => $this->port]); + $this->testConnection = TestFileTransfer::factory($this->root, ['hostname' => $this->hostname, 'username' => $this->username, 'password' => $this->password, 'port' => $this->port]); } public function _getFakeModuleFiles() { @@ -82,7 +82,7 @@ class FileTransferTest extends BrowserTestBase { $gotit = TRUE; try { - $this->testConnection->copyDirectory($source, \Drupal::root() . '/' . PublicStream::basePath()); + $this->testConnection->copyDirectory($source, $this->root . '/' . PublicStream::basePath()); } catch (FileTransferException $e) { $gotit = FALSE; diff --git a/core/modules/system/tests/src/Functional/Update/DependencyHookInvocationTest.php b/core/modules/system/tests/src/Functional/Update/DependencyHookInvocationTest.php index 8ff7b883db5..203d89ef2a7 100644 --- a/core/modules/system/tests/src/Functional/Update/DependencyHookInvocationTest.php +++ b/core/modules/system/tests/src/Functional/Update/DependencyHookInvocationTest.php @@ -21,7 +21,7 @@ class DependencyHookInvocationTest extends BrowserTestBase { protected function setUp() { parent::setUp(); - require_once \Drupal::root() . '/core/includes/update.inc'; + require_once $this->root . '/core/includes/update.inc'; } /** diff --git a/core/modules/system/tests/src/Functional/Update/DependencyMissingTest.php b/core/modules/system/tests/src/Functional/Update/DependencyMissingTest.php index 6ae4dc40c8f..e11999a46c2 100644 --- a/core/modules/system/tests/src/Functional/Update/DependencyMissingTest.php +++ b/core/modules/system/tests/src/Functional/Update/DependencyMissingTest.php @@ -22,7 +22,7 @@ class DependencyMissingTest extends BrowserTestBase { // Only install update_test_2.module, even though its updates have a // dependency on update_test_3.module. parent::setUp(); - require_once \Drupal::root() . '/core/includes/update.inc'; + require_once $this->root . '/core/includes/update.inc'; } public function testMissingUpdate() { diff --git a/core/modules/system/tests/src/Functional/Update/DependencyOrderingTest.php b/core/modules/system/tests/src/Functional/Update/DependencyOrderingTest.php index 8cafaaddba3..0f168aa78f5 100644 --- a/core/modules/system/tests/src/Functional/Update/DependencyOrderingTest.php +++ b/core/modules/system/tests/src/Functional/Update/DependencyOrderingTest.php @@ -20,7 +20,7 @@ class DependencyOrderingTest extends BrowserTestBase { protected function setUp() { parent::setUp(); - require_once \Drupal::root() . '/core/includes/update.inc'; + require_once $this->root . '/core/includes/update.inc'; } /** diff --git a/core/modules/system/tests/src/Functional/Update/InvalidUpdateHookTest.php b/core/modules/system/tests/src/Functional/Update/InvalidUpdateHookTest.php index 44d4832dd2c..85d041e2a48 100644 --- a/core/modules/system/tests/src/Functional/Update/InvalidUpdateHookTest.php +++ b/core/modules/system/tests/src/Functional/Update/InvalidUpdateHookTest.php @@ -35,7 +35,7 @@ class InvalidUpdateHookTest extends BrowserTestBase { protected function setUp() { parent::setUp(); - require_once \Drupal::root() . '/core/includes/update.inc'; + require_once $this->root . '/core/includes/update.inc'; $this->updateUrl = $GLOBALS['base_url'] . '/update.php'; $this->updateUser = $this->drupalCreateUser(['administer software updates']); diff --git a/core/modules/system/tests/src/Functional/Update/UpdateSchemaTest.php b/core/modules/system/tests/src/Functional/Update/UpdateSchemaTest.php index a42cbcb3c2a..1c2edee065d 100644 --- a/core/modules/system/tests/src/Functional/Update/UpdateSchemaTest.php +++ b/core/modules/system/tests/src/Functional/Update/UpdateSchemaTest.php @@ -35,7 +35,7 @@ class UpdateSchemaTest extends BrowserTestBase { protected function setUp() { parent::setUp(); - require_once \Drupal::root() . '/core/includes/update.inc'; + require_once $this->root . '/core/includes/update.inc'; $this->user = $this->drupalCreateUser(['administer software updates', 'access site in maintenance mode']); $this->updateUrl = Url::fromRoute('system.db_update'); } diff --git a/core/modules/system/tests/src/Functional/Update/UpdatesWith7xTest.php b/core/modules/system/tests/src/Functional/Update/UpdatesWith7xTest.php index 2452264e37a..4f536ea5aa4 100644 --- a/core/modules/system/tests/src/Functional/Update/UpdatesWith7xTest.php +++ b/core/modules/system/tests/src/Functional/Update/UpdatesWith7xTest.php @@ -31,7 +31,7 @@ class UpdatesWith7xTest extends BrowserTestBase { protected function setUp() { parent::setUp(); - require_once \Drupal::root() . '/core/includes/update.inc'; + require_once $this->root . '/core/includes/update.inc'; $this->updateUrl = $GLOBALS['base_url'] . '/update.php'; $this->updateUser = $this->drupalCreateUser(['administer software updates']); } diff --git a/core/modules/system/tests/src/Kernel/Common/SystemListingTest.php b/core/modules/system/tests/src/Kernel/Common/SystemListingTest.php index 221daeeaeb8..1a3f373f34a 100644 --- a/core/modules/system/tests/src/Kernel/Common/SystemListingTest.php +++ b/core/modules/system/tests/src/Kernel/Common/SystemListingTest.php @@ -33,13 +33,13 @@ class SystemListingTest extends KernelTestBase { foreach ($expected_directories as $module => $directories) { foreach ($directories as $directory) { $filename = "$directory/$module/$module.info.yml"; - $this->assertTrue(file_exists(\Drupal::root() . '/' . $filename), format_string('@filename exists.', ['@filename' => $filename])); + $this->assertTrue(file_exists($this->root . '/' . $filename), format_string('@filename exists.', ['@filename' => $filename])); } } // Now scan the directories and check that the files take precedence as // expected. - $listing = new ExtensionDiscovery(\Drupal::root()); + $listing = new ExtensionDiscovery($this->root); $listing->setProfileDirectories(['core/profiles/testing']); $files = $listing->scan('module'); foreach ($expected_directories as $module => $directories) { @@ -56,7 +56,7 @@ class SystemListingTest extends KernelTestBase { * Tests that directories matching file_scan_ignore_directories are ignored */ public function testFileScanIgnoreDirectory() { - $listing = new ExtensionDiscovery(\Drupal::root(), FALSE); + $listing = new ExtensionDiscovery($this->root, FALSE); $listing->setProfileDirectories(['core/profiles/testing']); $files = $listing->scan('module'); $this->assertArrayHasKey('drupal_system_listing_compatible_test', $files); @@ -68,7 +68,7 @@ class SystemListingTest extends KernelTestBase { $reflected_property->setValue($reflected_class, []); $this->setSetting('file_scan_ignore_directories', ['drupal_system_listing_compatible_test']); - $listing = new ExtensionDiscovery(\Drupal::root(), FALSE); + $listing = new ExtensionDiscovery($this->root, FALSE); $listing->setProfileDirectories(['core/profiles/testing']); $files = $listing->scan('module'); $this->assertArrayNotHasKey('drupal_system_listing_compatible_test', $files); diff --git a/core/modules/taxonomy/tests/src/Functional/VocabularyCrudTest.php b/core/modules/taxonomy/tests/src/Functional/VocabularyCrudTest.php index 7803f3966e7..1fb01630bf6 100644 --- a/core/modules/taxonomy/tests/src/Functional/VocabularyCrudTest.php +++ b/core/modules/taxonomy/tests/src/Functional/VocabularyCrudTest.php @@ -164,7 +164,7 @@ class VocabularyCrudTest extends TaxonomyTestBase { // installed for testing below. $this->vocabulary->unsetThirdPartySetting('taxonomy_crud', 'foo'); - require_once \Drupal::root() . '/core/includes/install.inc'; + require_once $this->root . '/core/includes/install.inc'; $this->container->get('module_installer')->uninstall(['taxonomy']); $this->container->get('module_installer')->install(['taxonomy']); diff --git a/core/modules/update/tests/src/Functional/UpdateUploadTest.php b/core/modules/update/tests/src/Functional/UpdateUploadTest.php index 60966200629..e86dff54981 100644 --- a/core/modules/update/tests/src/Functional/UpdateUploadTest.php +++ b/core/modules/update/tests/src/Functional/UpdateUploadTest.php @@ -190,10 +190,10 @@ class UpdateUploadTest extends UpdateTestBase { * Tests only an *.info.yml file are detected without supporting files. */ public function testUpdateDirectory() { - $type = Updater::getUpdaterFromDirectory(\Drupal::root() . '/core/modules/update/tests/modules/aaa_update_test'); + $type = Updater::getUpdaterFromDirectory($this->root . '/core/modules/update/tests/modules/aaa_update_test'); $this->assertEqual($type, 'Drupal\\Core\\Updater\\Module', 'Detected a Module'); - $type = Updater::getUpdaterFromDirectory(\Drupal::root() . '/core/modules/update/tests/themes/update_test_basetheme'); + $type = Updater::getUpdaterFromDirectory($this->root . '/core/modules/update/tests/themes/update_test_basetheme'); $this->assertEqual($type, 'Drupal\\Core\\Updater\\Theme', 'Detected a Theme.'); } diff --git a/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php b/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php index 643302192c7..fe967b2d9f6 100644 --- a/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php +++ b/core/modules/user/tests/src/Kernel/UserAccountFormFieldsTest.php @@ -24,8 +24,8 @@ class UserAccountFormFieldsTest extends KernelTestBase { * Tests the root user account form section in the "Configure site" form. */ public function testInstallConfigureForm() { - require_once \Drupal::root() . '/core/includes/install.core.inc'; - require_once \Drupal::root() . '/core/includes/install.inc'; + require_once $this->root . '/core/includes/install.core.inc'; + require_once $this->root . '/core/includes/install.inc'; $install_state = install_state_defaults(); $form_state = new FormState(); $form_state->addBuildInfo('args', [&$install_state]); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php index da63ec9b308..ac2c46297f0 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguageDirectionTest.php @@ -21,8 +21,8 @@ class InstallerLanguageDirectionTest extends InstallerTestBase { */ protected function setUpLanguage() { // Place a custom local translation in the translations directory. - mkdir(\Drupal::root() . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE); - file_put_contents(\Drupal::root() . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.ar.po', "msgid \"\"\nmsgstr \"\"\nmsgid \"Save and continue\"\nmsgstr \"Save and continue Arabic\""); + mkdir($this->root . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE); + file_put_contents($this->root . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.ar.po', "msgid \"\"\nmsgstr \"\"\nmsgid \"Save and continue\"\nmsgstr \"Save and continue Arabic\""); parent::setUpLanguage(); // After selecting a different language than English, all following screens diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguagePageTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguagePageTest.php index a040da965ca..5ea9692f341 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguagePageTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerLanguagePageTest.php @@ -16,8 +16,8 @@ class InstallerLanguagePageTest extends InstallerTestBase { */ protected function setUpLanguage() { // Place a custom local translation in the translations directory. - mkdir(\Drupal::root() . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE); - touch(\Drupal::root() . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.xoxo.po'); + mkdir($this->root . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE); + touch($this->root . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.xoxo.po'); // Check that all predefined languages show up with their native names. $this->visitInstaller(); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php index 974318b08d3..2f6deba4dee 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php @@ -19,7 +19,7 @@ class InstallerTest extends InstallerTestBase { $this->assertText($this->rootUser->getUsername()); // Verify that the confirmation message appears. - require_once \Drupal::root() . '/core/includes/install.inc'; + require_once $this->root . '/core/includes/install.inc'; $this->assertRaw(t('Congratulations, you installed @drupal!', [ '@drupal' => drupal_install_profile_distribution_name(), ])); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php index 8a6cc1e8c39..152713b2732 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationQueryTest.php @@ -23,8 +23,8 @@ class InstallerTranslationQueryTest extends InstallerTestBase { */ protected function visitInstaller() { // Place a custom local translation in the translations directory. - mkdir(\Drupal::root() . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE); - file_put_contents(\Drupal::root() . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.de.po', $this->getPo('de')); + mkdir($this->root . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE); + file_put_contents($this->root . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.de.po', $this->getPo('de')); // The unrouted URL assembler does not exist at this point, so we build the // URL ourselves. diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php index 974d2825883..ecf7d8867a1 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTranslationTest.php @@ -24,8 +24,8 @@ class InstallerTranslationTest extends InstallerTestBase { */ protected function setUpLanguage() { // Place a custom local translation in the translations directory. - mkdir(\Drupal::root() . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE); - file_put_contents(\Drupal::root() . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.de.po', $this->getPo('de')); + mkdir($this->root . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE); + file_put_contents($this->root . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.de.po', $this->getPo('de')); parent::setUpLanguage(); diff --git a/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php index 8e192d4c541..34b4cc4dbef 100644 --- a/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php +++ b/core/tests/Drupal/FunctionalTests/Update/UpdatePathTestBase.php @@ -193,7 +193,7 @@ abstract class UpdatePathTestBase extends BrowserTestBase { $this->replaceUser1(); - require_once \Drupal::root() . '/core/includes/update.inc'; + require_once $this->root . '/core/includes/update.inc'; // Setup Mink. $session = $this->initMink(); diff --git a/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php b/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php index 2131a35ad0f..bbb3d6a5a02 100644 --- a/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php +++ b/core/tests/Drupal/KernelTests/Core/Asset/ResolvedLibraryDefinitionsFilesMatchTest.php @@ -149,7 +149,6 @@ class ResolvedLibraryDefinitionsFilesMatchTest extends KernelTestBase { * so on. */ protected function verifyLibraryFilesExist($library_definitions) { - $root = \Drupal::root(); foreach ($library_definitions as $extension => $libraries) { foreach ($libraries as $library_name => $library) { if (in_array("$extension/$library_name", $this->librariesToSkip)) { @@ -160,7 +159,7 @@ class ResolvedLibraryDefinitionsFilesMatchTest extends KernelTestBase { foreach (['css', 'js'] as $asset_type) { foreach ($library[$asset_type] as $asset) { $file = $asset['data']; - $path = $root . '/' . $file; + $path = $this->root . '/' . $file; // Only check and assert each file path once. if (!isset($this->pathsChecked[$path])) { $this->assertTrue(is_file($path), "$file file referenced from the $extension/$library_name library exists."); @@ -192,10 +191,9 @@ class ResolvedLibraryDefinitionsFilesMatchTest extends KernelTestBase { $libraries['core'] = $this->libraryDiscovery->getLibrariesByExtension('core'); - $root = \Drupal::root(); foreach ($extensions as $extension_name => $extension) { $library_file = $extension->getPath() . '/' . $extension_name . '.libraries.yml'; - if (is_file($root . '/' . $library_file)) { + if (is_file($this->root . '/' . $library_file)) { $libraries[$extension_name] = $this->libraryDiscovery->getLibrariesByExtension($extension_name); } } diff --git a/core/tests/Drupal/KernelTests/Core/EventSubscriber/IgnoreReplicaSubscriberTest.php b/core/tests/Drupal/KernelTests/Core/EventSubscriber/IgnoreReplicaSubscriberTest.php index 7ce994a9447..237edb63c31 100644 --- a/core/tests/Drupal/KernelTests/Core/EventSubscriber/IgnoreReplicaSubscriberTest.php +++ b/core/tests/Drupal/KernelTests/Core/EventSubscriber/IgnoreReplicaSubscriberTest.php @@ -28,7 +28,7 @@ class IgnoreReplicaSubscriberTest extends KernelTestBase { Database::addConnectionInfo('default', 'replica', $connection_info['default']); db_ignore_replica(); - $class_loader = require \Drupal::root() . '/autoload.php'; + $class_loader = require $this->root . '/autoload.php'; $kernel = new DrupalKernel('testing', $class_loader, FALSE); $event = new GetResponseEvent($kernel, Request::create('http://example.com'), HttpKernelInterface::MASTER_REQUEST); $subscriber = new ReplicaDatabaseIgnoreSubscriber(); diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/AnnotatedClassDiscoveryTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/AnnotatedClassDiscoveryTest.php index 9003713f532..34168dab50a 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/AnnotatedClassDiscoveryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/AnnotatedClassDiscoveryTest.php @@ -73,8 +73,8 @@ class AnnotatedClassDiscoveryTest extends DiscoveryTestBase { ], ]; - $base_directory = \Drupal::root() . '/core/modules/system/tests/modules/plugin_test/src'; - $base_directory2 = \Drupal::root() . '/core/modules/system/tests/modules/plugin_test_extended/src'; + $base_directory = $this->root . '/core/modules/system/tests/modules/plugin_test/src'; + $base_directory2 = $this->root . '/core/modules/system/tests/modules/plugin_test_extended/src'; $namespaces = new \ArrayObject(['Drupal\plugin_test' => $base_directory, 'Drupal\plugin_test_extended' => $base_directory2]); $annotation_namespaces = ['Drupal\plugin_test\Plugin\Annotation', 'Drupal\plugin_test_extended\Plugin\Annotation']; diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php index 3ae576cfdfb..c6e32b7124f 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/CustomAnnotationClassDiscoveryTest.php @@ -30,7 +30,7 @@ class CustomAnnotationClassDiscoveryTest extends DiscoveryTestBase { ], ]; - $base_directory = \Drupal::root() . '/core/modules/system/tests/modules/plugin_test/src'; + $base_directory = $this->root . '/core/modules/system/tests/modules/plugin_test/src'; $root_namespaces = new \ArrayObject(['Drupal\plugin_test' => $base_directory]); $this->discovery = new AnnotatedClassDiscovery('Plugin/plugin_test/custom_annotation', $root_namespaces, 'Drupal\plugin_test\Plugin\Annotation\PluginExample'); diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/CustomDirectoryAnnotatedClassDiscoveryTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/CustomDirectoryAnnotatedClassDiscoveryTest.php index a6ae259bc2f..1074eb1ba52 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/CustomDirectoryAnnotatedClassDiscoveryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/Discovery/CustomDirectoryAnnotatedClassDiscoveryTest.php @@ -80,7 +80,7 @@ class CustomDirectoryAnnotatedClassDiscoveryTest extends DiscoveryTestBase { ], ]; - $base_directory = \Drupal::root() . '/core/modules/system/tests/modules/plugin_test/src'; + $base_directory = $this->root . '/core/modules/system/tests/modules/plugin_test/src'; $namespaces = new \ArrayObject(['Drupal\plugin_test' => $base_directory]); $this->discovery = new AnnotatedClassDiscovery('', $namespaces); diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/PluginTestBase.php b/core/tests/Drupal/KernelTests/Core/Plugin/PluginTestBase.php index ccc82369a0e..fac49b214ab 100644 --- a/core/tests/Drupal/KernelTests/Core/Plugin/PluginTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Plugin/PluginTestBase.php @@ -42,7 +42,7 @@ abstract class PluginTestBase extends KernelTestBase { // as derivatives and ReflectionFactory. $this->testPluginManager = new TestPluginManager(); $this->mockBlockManager = new MockBlockManager(); - $module_handler = new ModuleHandler(\Drupal::root(), [], new MemoryBackend(), $this->container->get('event_dispatcher')); + $module_handler = new ModuleHandler($this->root, [], new MemoryBackend(), $this->container->get('event_dispatcher')); $this->defaultsTestPluginManager = new DefaultsTestPluginManager($module_handler); // The expected plugin definitions within each manager. Several tests assert diff --git a/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteNoneTest.php b/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteNoneTest.php index 2b599339294..6d26891fdbc 100644 --- a/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteNoneTest.php +++ b/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteNoneTest.php @@ -53,7 +53,7 @@ class RouteNoneTest extends KernelTestBase { // Test request with subdir on homepage. $server = [ 'SCRIPT_NAME' => '/subdir/index.php', - 'SCRIPT_FILENAME' => \Drupal::root() . '/index.php', + 'SCRIPT_FILENAME' => $this->root . '/index.php', 'SERVER_NAME' => 'http://www.example.com', ]; $request = Request::create('/subdir', 'GET', [], [], [], $server); @@ -70,7 +70,7 @@ class RouteNoneTest extends KernelTestBase { // Test request with subdir on other page. $server = [ 'SCRIPT_NAME' => '/subdir/index.php', - 'SCRIPT_FILENAME' => \Drupal::root() . '/index.php', + 'SCRIPT_FILENAME' => $this->root . '/index.php', 'SERVER_NAME' => 'http://www.example.com', ]; $request = Request::create('/subdir/node/add', 'GET', [], [], [], $server); @@ -87,7 +87,7 @@ class RouteNoneTest extends KernelTestBase { // Test request without subdir on the homepage. $server = [ 'SCRIPT_NAME' => '/index.php', - 'SCRIPT_FILENAME' => \Drupal::root() . '/index.php', + 'SCRIPT_FILENAME' => $this->root . '/index.php', 'SERVER_NAME' => 'http://www.example.com', ]; $request = Request::create('/', 'GET', [], [], [], $server); @@ -104,7 +104,7 @@ class RouteNoneTest extends KernelTestBase { // Test request without subdir on other page. $server = [ 'SCRIPT_NAME' => '/index.php', - 'SCRIPT_FILENAME' => \Drupal::root() . '/index.php', + 'SCRIPT_FILENAME' => $this->root . '/index.php', 'SERVER_NAME' => 'http://www.example.com', ]; $request = Request::create('/node/add', 'GET', [], [], [], $server); diff --git a/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteProcessorCurrentIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteProcessorCurrentIntegrationTest.php index ea6a9c25380..4e42271aa58 100644 --- a/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteProcessorCurrentIntegrationTest.php +++ b/core/tests/Drupal/KernelTests/Core/RouteProcessor/RouteProcessorCurrentIntegrationTest.php @@ -54,7 +54,7 @@ class RouteProcessorCurrentIntegrationTest extends KernelTestBase { // Test request with subdir on homepage. $server = [ 'SCRIPT_NAME' => '/subdir/index.php', - 'SCRIPT_FILENAME' => \Drupal::root() . '/index.php', + 'SCRIPT_FILENAME' => $this->root . '/index.php', 'SERVER_NAME' => 'http://www.example.com', ]; $request = Request::create('/subdir/', 'GET', [], [], [], $server); @@ -69,7 +69,7 @@ class RouteProcessorCurrentIntegrationTest extends KernelTestBase { // Test request with subdir on other page. $server = [ 'SCRIPT_NAME' => '/subdir/index.php', - 'SCRIPT_FILENAME' => \Drupal::root() . '/index.php', + 'SCRIPT_FILENAME' => $this->root . '/index.php', 'SERVER_NAME' => 'http://www.example.com', ]; $request = Request::create('/subdir/node/add', 'GET', [], [], [], $server); @@ -84,7 +84,7 @@ class RouteProcessorCurrentIntegrationTest extends KernelTestBase { // Test request without subdir on the homepage. $server = [ 'SCRIPT_NAME' => '/index.php', - 'SCRIPT_FILENAME' => \Drupal::root() . '/index.php', + 'SCRIPT_FILENAME' => $this->root . '/index.php', 'SERVER_NAME' => 'http://www.example.com', ]; $request = Request::create('/', 'GET', [], [], [], $server); @@ -99,7 +99,7 @@ class RouteProcessorCurrentIntegrationTest extends KernelTestBase { // Test request without subdir on other page. $server = [ 'SCRIPT_NAME' => '/index.php', - 'SCRIPT_FILENAME' => \Drupal::root() . '/index.php', + 'SCRIPT_FILENAME' => $this->root . '/index.php', 'SERVER_NAME' => 'http://www.example.com', ]; $request = Request::create('/node/add', 'GET', [], [], [], $server); @@ -115,7 +115,7 @@ class RouteProcessorCurrentIntegrationTest extends KernelTestBase { // not found exception page. $server = [ 'SCRIPT_NAME' => '/index.php', - 'SCRIPT_FILENAME' => \Drupal::root() . '/index.php', + 'SCRIPT_FILENAME' => $this->root . '/index.php', 'SERVER_NAME' => 'http://www.example.com', ]; $request = Request::create('/invalid-path', 'GET', [], [], [], $server); diff --git a/core/tests/Drupal/KernelTests/Core/Site/SettingsRewriteTest.php b/core/tests/Drupal/KernelTests/Core/Site/SettingsRewriteTest.php index 40a8a743dd3..05078711244 100644 --- a/core/tests/Drupal/KernelTests/Core/Site/SettingsRewriteTest.php +++ b/core/tests/Drupal/KernelTests/Core/Site/SettingsRewriteTest.php @@ -16,7 +16,7 @@ class SettingsRewriteTest extends KernelTestBase { * Tests the drupal_rewrite_settings() function. */ public function testDrupalRewriteSettings() { - include_once \Drupal::root() . '/core/includes/install.inc'; + include_once $this->root . '/core/includes/install.inc'; $site_path = $this->container->get('site.path'); $tests = [ [ diff --git a/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php b/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php index 169da31925d..320e92f46a1 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/RegistryTest.php @@ -69,11 +69,11 @@ class RegistryTest extends KernelTestBase { $theme_handler = \Drupal::service('theme_handler'); $theme_handler->install(['test_basetheme', 'test_subtheme', 'test_subsubtheme']); - $registry_subsub_theme = new Registry(\Drupal::root(), \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_subsubtheme'); + $registry_subsub_theme = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_subsubtheme'); $registry_subsub_theme->setThemeManager(\Drupal::theme()); - $registry_sub_theme = new Registry(\Drupal::root(), \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_subtheme'); + $registry_sub_theme = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_subtheme'); $registry_sub_theme->setThemeManager(\Drupal::theme()); - $registry_base_theme = new Registry(\Drupal::root(), \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_basetheme'); + $registry_base_theme = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_basetheme'); $registry_base_theme->setThemeManager(\Drupal::theme()); $preprocess_functions = $registry_subsub_theme->get()['theme_test_template_test']['preprocess functions']; @@ -111,7 +111,7 @@ class RegistryTest extends KernelTestBase { $theme_handler = \Drupal::service('theme_handler'); $theme_handler->install(['test_theme']); - $registry_theme = new Registry(\Drupal::root(), \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_theme'); + $registry_theme = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_theme'); $registry_theme->setThemeManager(\Drupal::theme()); $suggestions = ['__kitten', '__flamingo']; @@ -154,7 +154,7 @@ class RegistryTest extends KernelTestBase { $theme_handler->install(['test_theme']); $this->config('system.theme')->set('default', 'test_theme')->save(); - $registry = new Registry(\Drupal::root(), \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_theme'); + $registry = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_theme'); $registry->setThemeManager(\Drupal::theme()); $this->assertEqual('value', $registry->get()['theme_test_template_test']['variables']['additional']); } @@ -199,7 +199,7 @@ class RegistryTest extends KernelTestBase { $theme_handler = \Drupal::service('theme_handler'); $theme_handler->install(['test_theme']); - $registry_theme = new Registry(\Drupal::root(), \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_theme'); + $registry_theme = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $theme_handler, \Drupal::service('theme.initialization'), 'test_theme'); $registry_theme->setThemeManager(\Drupal::theme()); $expected = [ diff --git a/core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTest.php index a71c3fe6422..1976b2684c2 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/StableLibraryOverrideTest.php @@ -94,7 +94,6 @@ class StableLibraryOverrideTest extends KernelTestBase { $libraries_after = $this->getAllLibraries(); $libraries_after = $this->removeVendorAssets($libraries_after); - $root = \Drupal::root(); foreach ($libraries_before as $extension => $libraries) { foreach ($libraries as $library_name => $library) { // Allow skipping libraries. @@ -173,10 +172,9 @@ class StableLibraryOverrideTest extends KernelTestBase { $libraries['core'] = $this->libraryDiscovery->getLibrariesByExtension('core'); - $root = \Drupal::root(); foreach ($modules as $module_name => $module) { $library_file = $module->getPath() . '/' . $module_name . '.libraries.yml'; - if (is_file($root . '/' . $library_file)) { + if (is_file($this->root . '/' . $library_file)) { $libraries[$module_name] = $this->libraryDiscovery->getLibrariesByExtension($module_name); } } diff --git a/core/tests/Drupal/KernelTests/Core/Theme/StableTemplateOverrideTest.php b/core/tests/Drupal/KernelTests/Core/Theme/StableTemplateOverrideTest.php index edb66939c23..88bbde23a09 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/StableTemplateOverrideTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/StableTemplateOverrideTest.php @@ -82,7 +82,7 @@ class StableTemplateOverrideTest extends KernelTestBase { * Ensures that Stable overrides all relevant core templates. */ public function testStableTemplateOverrides() { - $registry = new Registry(\Drupal::root(), \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $this->themeHandler, \Drupal::service('theme.initialization'), 'stable'); + $registry = new Registry($this->root, \Drupal::cache(), \Drupal::lock(), \Drupal::moduleHandler(), $this->themeHandler, \Drupal::service('theme.initialization'), 'stable'); $registry->setThemeManager(\Drupal::theme()); $registry_full = $registry->get(); diff --git a/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php b/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php index 130df2baee5..cf0e7d2c212 100644 --- a/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Theme/ThemeSettingsTest.php @@ -33,7 +33,7 @@ class ThemeSettingsTest extends KernelTestBase { $this->installConfig(['system']); if (!isset($this->availableThemes)) { - $discovery = new ExtensionDiscovery(\Drupal::root()); + $discovery = new ExtensionDiscovery($this->root); $this->availableThemes = $discovery->scan('theme'); } } diff --git a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php index 581960ed509..77714653073 100644 --- a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php +++ b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php @@ -250,7 +250,7 @@ class TypedDataTest extends KernelTestBase { $files = []; for ($i = 0; $i < 3; $i++) { $path = "public://example_$i.png"; - file_unmanaged_copy(\Drupal::root() . '/core/misc/druplicon.png', $path); + file_unmanaged_copy($this->root . '/core/misc/druplicon.png', $path); $image = File::create(['uri' => $path]); $image->save(); $files[] = $image; diff --git a/core/tests/Drupal/KernelTests/Core/Update/CompatibilityFixTest.php b/core/tests/Drupal/KernelTests/Core/Update/CompatibilityFixTest.php index a724623ec37..20a45cad5c1 100644 --- a/core/tests/Drupal/KernelTests/Core/Update/CompatibilityFixTest.php +++ b/core/tests/Drupal/KernelTests/Core/Update/CompatibilityFixTest.php @@ -18,7 +18,7 @@ class CompatibilityFixTest extends KernelTestBase { protected function setUp() { parent::setUp(); - require_once \Drupal::root() . '/core/includes/update.inc'; + require_once $this->root . '/core/includes/update.inc'; } public function testFixCompatibility() { diff --git a/core/tests/Drupal/KernelTests/Core/Updater/UpdaterTest.php b/core/tests/Drupal/KernelTests/Core/Updater/UpdaterTest.php index 9f26f4a454d..be6029fe673 100644 --- a/core/tests/Drupal/KernelTests/Core/Updater/UpdaterTest.php +++ b/core/tests/Drupal/KernelTests/Core/Updater/UpdaterTest.php @@ -24,7 +24,7 @@ class UpdaterTest extends KernelTestBase { public function testGetProjectTitleWithChild() { // Get the project title from its directory. If it can't find the title // it will choose the first project title in the directory. - $directory = \Drupal::root() . '/core/modules/system/tests/modules/module_handler_test_multiple'; + $directory = $this->root . '/core/modules/system/tests/modules/module_handler_test_multiple'; $title = Updater::getProjectTitle($directory); $this->assertEqual('module handler test multiple', $title); } diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php index 7f5e61c1214..71cb93f08b4 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBase.php +++ b/core/tests/Drupal/KernelTests/KernelTestBase.php @@ -812,7 +812,7 @@ abstract class KernelTestBase extends TestCase implements ServiceProviderInterfa // profile that is not the current profile, and we don't yet have a cached // way to receive inactive profile information. // @todo Remove as part of https://www.drupal.org/node/2186491 - $listing = new ExtensionDiscovery(\Drupal::root()); + $listing = new ExtensionDiscovery($this->root); $module_list = $listing->scan('module'); // In ModuleHandlerTest we pass in a profile as if it were a module. $module_list += $listing->scan('profile');