diff --git a/core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php b/core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php
index 3917a16..9c5375a 100644
--- a/core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php
+++ b/core/modules/basic_auth/src/Tests/Authentication/BasicAuthTest.php
@@ -58,7 +58,7 @@ public function testBasicAuth() {
* Test the global login flood control.
*/
function testGlobalLoginFloodControl() {
- \Drupal::config('user.flood')
+ $this->config('user.flood')
->set('ip_limit', 2)
// Set a high per-user limit out so that it is not relevant in the test.
->set('user_limit', 4000)
@@ -82,7 +82,7 @@ function testGlobalLoginFloodControl() {
* Test the per-user login flood control.
*/
function testPerUserLoginFloodControl() {
- \Drupal::config('user.flood')
+ $this->config('user.flood')
// Set a high global limit out so that it is not relevant in the test.
->set('ip_limit', 4000)
->set('user_limit', 2)
@@ -120,7 +120,7 @@ function testPerUserLoginFloodControl() {
*/
function testLocale() {
ConfigurableLanguage::createFromLangcode('de')->save();
- \Drupal::config('system.site')->set('langcode', 'de')->save();
+ $this->config('system.site')->set('langcode', 'de')->save();
$account = $this->drupalCreateUser();
diff --git a/core/modules/block/src/Tests/BlockConfigSchemaTest.php b/core/modules/block/src/Tests/BlockConfigSchemaTest.php
index c12fb65..9d7bcfe 100644
--- a/core/modules/block/src/Tests/BlockConfigSchemaTest.php
+++ b/core/modules/block/src/Tests/BlockConfigSchemaTest.php
@@ -89,7 +89,7 @@ public function testBlockConfigSchema() {
));
$block->save();
- $config = \Drupal::config("block.block.$id");
+ $config = $this->config("block.block.$id");
$this->assertEqual($config->get('id'), $id);
$this->assertConfigSchema($this->typedConfig, $config->getName(), $config->get());
}
diff --git a/core/modules/block/src/Tests/BlockHiddenRegionTest.php b/core/modules/block/src/Tests/BlockHiddenRegionTest.php
index f451103..b5abe7c 100644
--- a/core/modules/block/src/Tests/BlockHiddenRegionTest.php
+++ b/core/modules/block/src/Tests/BlockHiddenRegionTest.php
@@ -56,7 +56,7 @@ public function testBlockNotInHiddenRegion() {
// Install "block_test_theme" and set it as the default theme.
$theme = 'block_test_theme';
\Drupal::service('theme_handler')->install(array($theme));
- \Drupal::config('system.theme')
+ $this->config('system.theme')
->set('default', $theme)
->save();
// Installing a theme will cause the kernel terminate event to rebuild the
diff --git a/core/modules/block/src/Tests/BlockLanguageTest.php b/core/modules/block/src/Tests/BlockLanguageTest.php
index 958a08e..df5e693 100644
--- a/core/modules/block/src/Tests/BlockLanguageTest.php
+++ b/core/modules/block/src/Tests/BlockLanguageTest.php
@@ -50,7 +50,7 @@ protected function setUp() {
*/
public function testLanguageBlockVisibility() {
// Check if the visibility setting is available.
- $default_theme = \Drupal::config('system.theme')->get('default');
+ $default_theme = $this->config('system.theme')->get('default');
$this->drupalGet('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme);
$this->assertField('visibility[language][langcodes][en]', 'Language visibility field is visible.');
@@ -128,7 +128,7 @@ public function testMultipleLanguageTypes() {
$this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings'));
// Check if the visibility setting is available with a type setting.
- $default_theme = \Drupal::config('system.theme')->get('default');
+ $default_theme = $this->config('system.theme')->get('default');
$this->drupalGet('admin/structure/block/add/system_powered_by_block' . '/' . $default_theme);
$this->assertField('visibility[language][langcodes][en]', 'Language visibility field is visible.');
$this->assertField('visibility[language][context_mapping][language]', 'Language type field is visible.');
diff --git a/core/modules/block/src/Tests/BlockStorageUnitTest.php b/core/modules/block/src/Tests/BlockStorageUnitTest.php
index b550bcc..86f7d2f 100644
--- a/core/modules/block/src/Tests/BlockStorageUnitTest.php
+++ b/core/modules/block/src/Tests/BlockStorageUnitTest.php
@@ -78,7 +78,7 @@ protected function createTests() {
$this->assertTrue($entity instanceof Block, 'The newly created entity is a Block.');
// Verify all of the block properties.
- $actual_properties = \Drupal::config('block.block.test_block')->get();
+ $actual_properties = $this->config('block.block.test_block')->get();
$this->assertTrue(!empty($actual_properties['uuid']), 'The block UUID is set.');
unset($actual_properties['uuid']);
diff --git a/core/modules/block/src/Tests/BlockSystemBrandingTest.php b/core/modules/block/src/Tests/BlockSystemBrandingTest.php
index 7bf81e1..82cff41 100644
--- a/core/modules/block/src/Tests/BlockSystemBrandingTest.php
+++ b/core/modules/block/src/Tests/BlockSystemBrandingTest.php
@@ -27,7 +27,7 @@ class BlockSystemBrandingTest extends BlockTestBase {
protected function setUp() {
parent::setUp();
// Set a site slogan.
- \Drupal::config('system.site')
+ $this->config('system.site')
->set('slogan', 'Community plumbing')
->save();
// Add the system branding block to the page.
@@ -53,7 +53,7 @@ public function testSystemBrandingSettings() {
$this->assertTrue(!empty($site_slogan_element), 'The branding block slogan was found.');
// Turn just the logo off.
- \Drupal::config('block.block.site-branding')
+ $this->config('block.block.site-branding')
->set('settings.use_site_logo', 0)
->save();
$this->drupalGet('');
@@ -66,7 +66,7 @@ public function testSystemBrandingSettings() {
$this->assertTrue(!empty($site_slogan_element), 'The branding block slogan was found.');
// Turn just the site name off.
- \Drupal::config('block.block.site-branding')
+ $this->config('block.block.site-branding')
->set('settings.use_site_logo', 1)
->set('settings.use_site_name', 0)
->save();
@@ -80,7 +80,7 @@ public function testSystemBrandingSettings() {
$this->assertTrue(!empty($site_slogan_element), 'The branding block slogan was found.');
// Turn just the site slogan off.
- \Drupal::config('block.block.site-branding')
+ $this->config('block.block.site-branding')
->set('settings.use_site_name', 1)
->set('settings.use_site_slogan', 0)
->save();
@@ -94,7 +94,7 @@ public function testSystemBrandingSettings() {
$this->assertTrue(empty($site_slogan_element), 'The branding block slogan was disabled.');
// Turn the site name and the site slogan off.
- \Drupal::config('block.block.site-branding')
+ $this->config('block.block.site-branding')
->set('settings.use_site_name', 0)
->set('settings.use_site_slogan', 0)
->save();
diff --git a/core/modules/block/src/Tests/BlockTest.php b/core/modules/block/src/Tests/BlockTest.php
index 809f289..6140404 100644
--- a/core/modules/block/src/Tests/BlockTest.php
+++ b/core/modules/block/src/Tests/BlockTest.php
@@ -28,7 +28,7 @@ function testBlockVisibility() {
// Create a random title for the block.
$title = $this->randomMachineName(8);
// Enable a standard block.
- $default_theme = \Drupal::config('system.theme')->get('default');
+ $default_theme = $this->config('system.theme')->get('default');
$edit = array(
'id' => strtolower($this->randomMachineName(8)),
'region' => 'sidebar_first',
@@ -66,7 +66,7 @@ public function testBlockToggleVisibility() {
// Create a random title for the block.
$title = $this->randomMachineName(8);
// Enable a standard block.
- $default_theme = \Drupal::config('system.theme')->get('default');
+ $default_theme = $this->config('system.theme')->get('default');
$edit = array(
'id' => strtolower($this->randomMachineName(8)),
'region' => 'sidebar_first',
@@ -102,7 +102,7 @@ function testBlockVisibilityListedEmpty() {
// Create a random title for the block.
$title = $this->randomMachineName(8);
// Enable a standard block.
- $default_theme = \Drupal::config('system.theme')->get('default');
+ $default_theme = $this->config('system.theme')->get('default');
$edit = array(
'id' => strtolower($this->randomMachineName(8)),
'region' => 'sidebar_first',
@@ -134,7 +134,7 @@ function testBlock() {
$block = array();
$block['id'] = 'system_powered_by_block';
$block['settings[label]'] = $this->randomMachineName(8);
- $block['theme'] = \Drupal::config('system.theme')->get('default');
+ $block['theme'] = $this->config('system.theme')->get('default');
$block['region'] = 'header';
// Set block title to confirm that interface works and override any custom titles.
@@ -236,7 +236,7 @@ function testHideBlockTitle() {
$title = $this->randomMachineName(8);
$id = strtolower($this->randomMachineName(8));
// Enable a standard block.
- $default_theme = \Drupal::config('system.theme')->get('default');
+ $default_theme = $this->config('system.theme')->get('default');
$edit = array(
'id' => $id,
'region' => 'sidebar_first',
@@ -275,7 +275,7 @@ function testHideBlockTitle() {
*/
function moveBlockToRegion(array $block, $region) {
// Set the created block to a specific region.
- $block += array('theme' => \Drupal::config('system.theme')->get('default'));
+ $block += array('theme' => $this->config('system.theme')->get('default'));
$edit = array();
$edit['blocks[' . $block['id'] . '][region]'] = $region;
$this->drupalPostForm('admin/structure/block', $edit, t('Save blocks'));
@@ -307,7 +307,7 @@ public function testBlockCacheTags() {
$this->drupalLogout();
// Enable page caching.
- $config = \Drupal::config('system.performance');
+ $config = $this->config('system.performance');
$config->set('cache.page.use_internal', 1);
$config->set('cache.page.max_age', 300);
$config->save();
diff --git a/core/modules/block/src/Tests/BlockTestBase.php b/core/modules/block/src/Tests/BlockTestBase.php
index bea4040..0aabffa 100644
--- a/core/modules/block/src/Tests/BlockTestBase.php
+++ b/core/modules/block/src/Tests/BlockTestBase.php
@@ -39,7 +39,7 @@ protected function setUp() {
parent::setUp();
// Use the test page as the front page.
- \Drupal::config('system.site')->set('page.front', 'test-page')->save();
+ $this->config('system.site')->set('page.front', 'test-page')->save();
// Create Full HTML text format.
$full_html_format = entity_create('filter_format', array(
@@ -66,7 +66,7 @@ protected function setUp() {
'footer',
);
$block_storage = $this->container->get('entity.manager')->getStorage('block');
- $blocks = $block_storage->loadByProperties(array('theme' => \Drupal::config('system.theme')->get('default')));
+ $blocks = $block_storage->loadByProperties(array('theme' => $this->config('system.theme')->get('default')));
foreach ($blocks as $block) {
$block->delete();
}
diff --git a/core/modules/block/src/Tests/BlockTitleXSSTest.php b/core/modules/block/src/Tests/BlockTitleXSSTest.php
index 5305df6..3790d56 100644
--- a/core/modules/block/src/Tests/BlockTitleXSSTest.php
+++ b/core/modules/block/src/Tests/BlockTitleXSSTest.php
@@ -38,7 +38,7 @@ function testXSSInTitle() {
$this->assertNoRaw('', 'The block title was properly sanitized when rendered.');
$this->drupalLogin($this->drupalCreateUser(array('administer blocks', 'access administration pages')));
- $default_theme = \Drupal::config('system.theme')->get('default');
+ $default_theme = $this->config('system.theme')->get('default');
$this->drupalGet('admin/structure/block/list/' . $default_theme);
$this->assertNoRaw("", 'The block title was properly sanitized in Block Plugin UI Admin page.');
}
diff --git a/core/modules/block/src/Tests/NewDefaultThemeBlocksTest.php b/core/modules/block/src/Tests/NewDefaultThemeBlocksTest.php
index 9ceab52..42bbf5d 100644
--- a/core/modules/block/src/Tests/NewDefaultThemeBlocksTest.php
+++ b/core/modules/block/src/Tests/NewDefaultThemeBlocksTest.php
@@ -27,7 +27,7 @@ class NewDefaultThemeBlocksTest extends WebTestBase {
* Check the enabled Bartik blocks are correctly copied over.
*/
function testNewDefaultThemeBlocks() {
- $default_theme = \Drupal::config('system.theme')->get('default');
+ $default_theme = $this->config('system.theme')->get('default');
// Add two instances of the user login block.
$this->drupalPlaceBlock('user_login_block', array(
@@ -46,7 +46,7 @@ function testNewDefaultThemeBlocks() {
$new_theme = 'bartik';
$this->assertFalse($new_theme == $default_theme, 'The new theme is different from the previous default theme.');
\Drupal::service('theme_handler')->install(array($new_theme));
- \Drupal::config('system.theme')
+ $this->config('system.theme')
->set('default', $new_theme)
->save();
diff --git a/core/modules/block/src/Tests/Views/DisplayBlockTest.php b/core/modules/block/src/Tests/Views/DisplayBlockTest.php
index fe30da5..474b8f1 100644
--- a/core/modules/block/src/Tests/Views/DisplayBlockTest.php
+++ b/core/modules/block/src/Tests/Views/DisplayBlockTest.php
@@ -184,7 +184,7 @@ protected function testDeleteBlockDisplay() {
*/
public function testViewsBlockForm() {
$this->drupalLogin($this->drupalCreateUser(array('administer blocks')));
- $default_theme = \Drupal::config('system.theme')->get('default');
+ $default_theme = $this->config('system.theme')->get('default');
$this->drupalGet('admin/structure/block/add/views_block:test_view_block-block_1/' . $default_theme);
$elements = $this->xpath('//input[@name="label"]');
$this->assertTrue(empty($elements), 'The label field is not found for Views blocks.');
diff --git a/core/modules/block_content/src/Tests/BlockContentCreationTest.php b/core/modules/block_content/src/Tests/BlockContentCreationTest.php
index a93b756..7797571 100644
--- a/core/modules/block_content/src/Tests/BlockContentCreationTest.php
+++ b/core/modules/block_content/src/Tests/BlockContentCreationTest.php
@@ -170,7 +170,7 @@ public function testBlockDelete() {
'region' => 'sidebar_first',
);
$block = entity_load('block_content', 1);
- $url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . \Drupal::config('system.theme')->get('default');
+ $url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . $this->config('system.theme')->get('default');
$this->drupalPostForm($url, $instance, t('Save block'));
$block = BlockContent::load(1);
@@ -224,7 +224,7 @@ public function testConfigDependencies() {
'region' => 'sidebar_first',
);
$block = entity_load('block_content', 1);
- $url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . \Drupal::config('system.theme')->get('default');
+ $url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . $this->config('system.theme')->get('default');
$this->drupalPostForm($url, $instance, t('Save block'));
$dependencies = \Drupal::service('config.manager')->findConfigEntityDependentsAsEntities('content', array($block->getConfigDependencyName()));
diff --git a/core/modules/block_content/src/Tests/BlockContentFieldTest.php b/core/modules/block_content/src/Tests/BlockContentFieldTest.php
index 4fc7bf6..7067a59 100644
--- a/core/modules/block_content/src/Tests/BlockContentFieldTest.php
+++ b/core/modules/block_content/src/Tests/BlockContentFieldTest.php
@@ -91,7 +91,7 @@ public function testBlockFields() {
);
$this->drupalPostForm(NULL, $edit, t('Save'));
$block = entity_load('block_content', 1);
- $url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . \Drupal::config('system.theme')->get('default');
+ $url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . $this->config('system.theme')->get('default');
// Place the block.
$instance = array(
'id' => Unicode::strtolower($edit['info[0][value]']),
diff --git a/core/modules/book/src/Tests/BookTest.php b/core/modules/book/src/Tests/BookTest.php
index 44c71ec..0064a66 100644
--- a/core/modules/book/src/Tests/BookTest.php
+++ b/core/modules/book/src/Tests/BookTest.php
@@ -481,9 +481,9 @@ function testBookNodeTypeChange() {
// 'page',
// );
// @endcode
- $current_config = \Drupal::config('book.settings')->get();
+ $current_config = $this->config('book.settings')->get();
$this->drupalPostForm('admin/structure/book/settings', array(), t('Save configuration'));
- $this->assertIdentical($current_config, \Drupal::config('book.settings')->get());
+ $this->assertIdentical($current_config, $this->config('book.settings')->get());
// Change the name, machine name and description.
$edit = array(
@@ -502,9 +502,9 @@ function testBookNodeTypeChange() {
// 'zebra',
// );
// @endcode
- $current_config = \Drupal::config('book.settings')->get();
+ $current_config = $this->config('book.settings')->get();
$this->drupalPostForm('admin/structure/book/settings', array(), t('Save configuration'));
- $this->assertIdentical($current_config, \Drupal::config('book.settings')->get());
+ $this->assertIdentical($current_config, $this->config('book.settings')->get());
$edit = array(
'name' => 'Animal book',
@@ -520,13 +520,13 @@ function testBookNodeTypeChange() {
// 'zebra',
// );
// @endcode
- $current_config = \Drupal::config('book.settings')->get();
+ $current_config = $this->config('book.settings')->get();
$this->drupalPostForm('admin/structure/book/settings', array(), t('Save configuration'));
- $this->assertIdentical($current_config, \Drupal::config('book.settings')->get());
+ $this->assertIdentical($current_config, $this->config('book.settings')->get());
// Ensure that after all the node type changes book.settings:child_type has
// the expected value.
- $this->assertEqual(\Drupal::config('book.settings')->get('child_type'), 'zebra');
+ $this->assertEqual($this->config('book.settings')->get('child_type'), 'zebra');
}
/**
diff --git a/core/modules/book/src/Tests/BookUninstallTest.php b/core/modules/book/src/Tests/BookUninstallTest.php
index a1d55f7..317a16a 100644
--- a/core/modules/book/src/Tests/BookUninstallTest.php
+++ b/core/modules/book/src/Tests/BookUninstallTest.php
@@ -52,7 +52,7 @@ public function testBookUninstall() {
'name' => $this->randomString(),
));
$content_type->save();
- $book_config = \Drupal::config('book.settings');
+ $book_config = $this->config('book.settings');
$allowed_types = $book_config->get('allowed_types');
$allowed_types[] = $content_type->id();
$book_config->set('allowed_types', $allowed_types)->save();
diff --git a/core/modules/ckeditor/src/Tests/CKEditorTest.php b/core/modules/ckeditor/src/Tests/CKEditorTest.php
index 9133ee0..f5a637b 100644
--- a/core/modules/ckeditor/src/Tests/CKEditorTest.php
+++ b/core/modules/ckeditor/src/Tests/CKEditorTest.php
@@ -264,7 +264,7 @@ function testBuildContentsCssJSSetting() {
// Enable the Bartik theme, which specifies a CKEditor stylesheet.
\Drupal::service('theme_handler')->install(['bartik']);
- \Drupal::config('system.theme')->set('default', 'bartik');
+ $this->config('system.theme')->set('default', 'bartik');
$expected[] = file_create_url('core/themes/bartik/css/ckeditor-iframe.css');
$this->assertIdentical($expected, $this->ckeditor->buildContentsCssJSSetting($editor), '"contentsCss" configuration part of JS settings built correctly while a theme providing a CKEditor stylesheet exists.');
}
diff --git a/core/modules/color/src/Tests/ColorTest.php b/core/modules/color/src/Tests/ColorTest.php
index 185faae..3456dca 100644
--- a/core/modules/color/src/Tests/ColorTest.php
+++ b/core/modules/color/src/Tests/ColorTest.php
@@ -105,7 +105,7 @@ function testColor() {
* color', 'Color set', etc) for the theme which being tested.
*/
function _testColor($theme, $test_values) {
- \Drupal::config('system.theme')
+ $this->config('system.theme')
->set('default', $theme)
->save();
$settings_path = 'admin/appearance/settings/' . $theme;
@@ -119,7 +119,7 @@ function _testColor($theme, $test_values) {
$this->drupalPostForm($settings_path, $edit, t('Save configuration'));
$this->drupalGet('');
- $stylesheets = \Drupal::config('color.theme.' . $theme)->get('stylesheets');
+ $stylesheets = $this->config('color.theme.' . $theme)->get('stylesheets');
foreach ($stylesheets as $stylesheet) {
$this->assertPattern('|' . file_create_url($stylesheet) . '|', 'Make sure the color stylesheet is included in the content. (' . $theme . ')');
$stylesheet_content = join("\n", file($stylesheet));
@@ -132,14 +132,14 @@ function _testColor($theme, $test_values) {
$this->drupalPostForm($settings_path, $edit, t('Save configuration'));
$this->drupalGet('');
- $stylesheets = \Drupal::config('color.theme.' . $theme)->get('stylesheets');
+ $stylesheets = $this->config('color.theme.' . $theme)->get('stylesheets');
foreach ($stylesheets as $stylesheet) {
$stylesheet_content = join("\n", file($stylesheet));
$this->assertTrue(strpos($stylesheet_content, 'color: ' . $test_values['scheme_color']) !== FALSE, 'Make sure the color we changed is in the color stylesheet. (' . $theme . ')');
}
// Test with aggregated CSS turned on.
- $config = \Drupal::config('system.performance');
+ $config = $this->config('system.performance');
$config->set('css.preprocess', 1);
$config->save();
$this->drupalGet('');
@@ -157,7 +157,7 @@ function _testColor($theme, $test_values) {
* Tests whether the provided color is valid.
*/
function testValidColor() {
- \Drupal::config('system.theme')
+ $this->config('system.theme')
->set('default', 'bartik')
->save();
$settings_path = 'admin/appearance/settings/bartik';
diff --git a/core/modules/comment/src/Tests/CommentLinksTest.php b/core/modules/comment/src/Tests/CommentLinksTest.php
index 34b8b41..4a18c8a 100644
--- a/core/modules/comment/src/Tests/CommentLinksTest.php
+++ b/core/modules/comment/src/Tests/CommentLinksTest.php
@@ -48,7 +48,7 @@ class CommentLinksTest extends CommentTestBase {
public function testCommentLinks() {
// Bartik theme alters comment links, so use a different theme.
\Drupal::service('theme_handler')->install(array('stark'));
- \Drupal::config('system.theme')
+ $this->config('system.theme')
->set('default', 'stark')
->save();
diff --git a/core/modules/comment/src/Tests/CommentPreviewTest.php b/core/modules/comment/src/Tests/CommentPreviewTest.php
index 8d188c3..f998887 100644
--- a/core/modules/comment/src/Tests/CommentPreviewTest.php
+++ b/core/modules/comment/src/Tests/CommentPreviewTest.php
@@ -41,7 +41,7 @@ function testCommentPreview() {
// Login as web user and add a signature and a user picture.
$this->drupalLogin($this->web_user);
- \Drupal::config('user.settings')->set('signatures', 1)->save();
+ $this->config('user.settings')->set('signatures', 1)->save();
$test_signature = $this->randomMachineName();
$edit['signature[value]'] = '' . $test_signature. '';
$image = current($this->drupalGetTestFiles('image'));
diff --git a/core/modules/config/src/Tests/ConfigCRUDTest.php b/core/modules/config/src/Tests/ConfigCRUDTest.php
index 4c3642e..bde8375 100644
--- a/core/modules/config/src/Tests/ConfigCRUDTest.php
+++ b/core/modules/config/src/Tests/ConfigCRUDTest.php
@@ -46,7 +46,7 @@ function testCRUD() {
$storage = $this->container->get('config.storage');
$name = 'config_test.crud';
- $config = \Drupal::config($name);
+ $config = $this->config($name);
$this->assertIdentical($config->isNew(), TRUE);
// Create a new configuration object.
@@ -67,8 +67,8 @@ function testCRUD() {
$actual_data = $storage->read($name);
$this->assertIdentical($actual_data, array('value' => 'instance-update'));
- // Verify a call to \Drupal::config() immediately returns the updated value.
- $new_config = \Drupal::config($name);
+ // Verify a call to $this->config() immediately returns the updated value.
+ $new_config = $this->config($name);
$this->assertIdentical($new_config->get(), $config->get());
$this->assertIdentical($config->isNew(), FALSE);
@@ -83,8 +83,8 @@ function testCRUD() {
$actual_data = $storage->read($name);
$this->assertIdentical($actual_data, FALSE);
- // Verify \Drupal::config() returns no data.
- $new_config = \Drupal::config($name);
+ // Verify $this->config() returns no data.
+ $new_config = $this->config($name);
$this->assertIdentical($new_config->get(), $config->get());
$this->assertIdentical($config->isNew(), TRUE);
@@ -97,36 +97,36 @@ function testCRUD() {
$actual_data = $storage->read($name);
$this->assertIdentical($actual_data, array('value' => 're-created'));
- // Verify a call to \Drupal::config() immediately returns the updated value.
- $new_config = \Drupal::config($name);
+ // Verify a call to $this->config() immediately returns the updated value.
+ $new_config = $this->config($name);
$this->assertIdentical($new_config->get(), $config->get());
$this->assertIdentical($config->isNew(), FALSE);
// Rename the configuration object.
$new_name = 'config_test.crud_rename';
$this->container->get('config.factory')->rename($name, $new_name);
- $renamed_config = \Drupal::config($new_name);
+ $renamed_config = $this->config($new_name);
$this->assertIdentical($renamed_config->get(), $config->get());
$this->assertIdentical($renamed_config->isNew(), FALSE);
// Ensure that the old configuration object is removed from both the cache
// and the configuration storage.
- $config = \Drupal::config($name);
+ $config = $this->config($name);
$this->assertIdentical($config->get(), array());
$this->assertIdentical($config->isNew(), TRUE);
// Test renaming when config.factory does not have the object in its static
// cache.
$name = 'config_test.crud_rename';
- $config = \Drupal::config($name);
+ $config = $this->config($name);
$new_name = 'config_test.crud_rename_no_cache';
$this->container->get('config.factory')->clearStaticCache()->rename($name, $new_name);
- $renamed_config = \Drupal::config($new_name);
+ $renamed_config = $this->config($new_name);
$this->assertIdentical($renamed_config->get(), $config->get());
$this->assertIdentical($renamed_config->isNew(), FALSE);
// Merge data into the configuration object.
- $new_config = \Drupal::config($new_name);
+ $new_config = $this->config($new_name);
$expected_values = array(
'value' => 'herp',
'404' => 'derp',
@@ -145,7 +145,7 @@ function testNameValidation() {
$name = 'nonamespace';
$message = 'Expected ConfigNameException was thrown for a name without a namespace.';
try {
- \Drupal::config($name)->save();
+ $this->config($name)->save();
$this->fail($message);
}
catch (ConfigNameException $e) {
@@ -156,7 +156,7 @@ function testNameValidation() {
$name = 'config_test.herman_melville.moby_dick_or_the_whale.harper_1851.now_small_fowls_flew_screaming_over_the_yet_yawning_gulf_a_sullen_white_surf_beat_against_its_steep_sides_then_all_collapsed_and_the_great_shroud_of_the_sea_rolled_on_as_it_rolled_five_thousand_years_ago';
$message = 'Expected ConfigNameException was thrown for a name longer than Config::MAX_NAME_LENGTH.';
try {
- \Drupal::config($name)->save();
+ $this->config($name)->save();
$this->fail($message);
}
catch (ConfigNameException $e) {
@@ -168,7 +168,7 @@ function testNameValidation() {
foreach ($test_characters as $i => $c) {
try {
$name = 'namespace.object' . $c;
- $config = \Drupal::config($name);
+ $config = $this->config($name);
$config->save();
}
catch (ConfigNameException $e) {
@@ -183,7 +183,7 @@ function testNameValidation() {
$name = 'namespace.object';
$message = 'ConfigNameException was not thrown for a valid object name.';
try {
- $config = \Drupal::config($name);
+ $config = $this->config($name);
$config->save();
$this->pass($message);
}
@@ -200,7 +200,7 @@ function testValueValidation() {
// Verify that setData() will catch dotted keys.
$message = 'Expected ConfigValueException was thrown from setData() for value with dotted keys.';
try {
- \Drupal::config('namespace.object')->setData(array('key.value' => 12))->save();
+ $this->config('namespace.object')->setData(array('key.value' => 12))->save();
$this->fail($message);
}
catch (ConfigValueException $e) {
@@ -210,7 +210,7 @@ function testValueValidation() {
// Verify that set() will catch dotted keys.
$message = 'Expected ConfigValueException was thrown from set() for value with dotted keys.';
try {
- \Drupal::config('namespace.object')->set('foo', array('key.value' => 12))->save();
+ $this->config('namespace.object')->set('foo', array('key.value' => 12))->save();
$this->fail($message);
}
catch (ConfigValueException $e) {
diff --git a/core/modules/config/src/Tests/ConfigDependencyTest.php b/core/modules/config/src/Tests/ConfigDependencyTest.php
index 88abef7..6c7b8ec 100644
--- a/core/modules/config/src/Tests/ConfigDependencyTest.php
+++ b/core/modules/config/src/Tests/ConfigDependencyTest.php
@@ -64,7 +64,7 @@ public function testDependencyMangement() {
$this->assertFalse(isset($dependents['config_test.dynamic.entity1']), 'config_test.dynamic.entity1 does not have a dependency on the Views module.');
// Ensure that the provider of the config entity is not actually written to
// the dependencies array.
- $raw_config = \Drupal::config('config_test.dynamic.entity1');
+ $raw_config = $this->config('config_test.dynamic.entity1');
$this->assertTrue(array_search('node', $raw_config->get('dependencies.module')) !== FALSE, 'Node module is written to the dependencies array as this has to be explicit.');
// Create additional entities to test dependencies on config entities.
diff --git a/core/modules/config/src/Tests/ConfigEntityNormalizeTest.php b/core/modules/config/src/Tests/ConfigEntityNormalizeTest.php
index 5e52cfe..b1c6297 100644
--- a/core/modules/config/src/Tests/ConfigEntityNormalizeTest.php
+++ b/core/modules/config/src/Tests/ConfigEntityNormalizeTest.php
@@ -23,7 +23,7 @@ public function testNormalize() {
$config_entity->save();
// Modify stored config entity, this is comparable with a schema change.
- $config = \Drupal::config('config_test.dynamic.system');
+ $config = $this->config('config_test.dynamic.system');
$data = array(
'label' => 'foobar',
'additional_key' => TRUE
@@ -34,7 +34,7 @@ public function testNormalize() {
$config_entity = entity_load('config_test', 'system', TRUE);
$config_entity->save();
- $config = \Drupal::config('config_test.dynamic.system');
+ $config = $this->config('config_test.dynamic.system');
$this->assertIdentical($config_entity->toArray(), $config->getRawData(), 'Stored config entity is equivalent to config schema.');
}
diff --git a/core/modules/config/src/Tests/ConfigExportImportUITest.php b/core/modules/config/src/Tests/ConfigExportImportUITest.php
index 0c35736..3139d1d 100644
--- a/core/modules/config/src/Tests/ConfigExportImportUITest.php
+++ b/core/modules/config/src/Tests/ConfigExportImportUITest.php
@@ -53,13 +53,13 @@ protected function setUp() {
* Tests a simple site export import case.
*/
public function testExportImport() {
- $this->originalSlogan = \Drupal::config('system.site')->get('slogan');
+ $this->originalSlogan = $this->config('system.site')->get('slogan');
$this->newSlogan = $this->randomString(16);
$this->assertNotEqual($this->newSlogan, $this->originalSlogan);
- \Drupal::config('system.site')
+ $this->config('system.site')
->set('slogan', $this->newSlogan)
->save();
- $this->assertEqual(\Drupal::config('system.site')->get('slogan'), $this->newSlogan);
+ $this->assertEqual($this->config('system.site')->get('slogan'), $this->newSlogan);
// Create a content type.
$this->content_type = $this->drupalCreateContentType();
@@ -92,10 +92,10 @@ public function testExportImport() {
$this->drupalPostForm('admin/config/development/configuration/full/export', array(), 'Export');
$this->tarball = $this->drupalGetContent();
- \Drupal::config('system.site')
+ $this->config('system.site')
->set('slogan', $this->originalSlogan)
->save();
- $this->assertEqual(\Drupal::config('system.site')->get('slogan'), $this->originalSlogan);
+ $this->assertEqual($this->config('system.site')->get('slogan'), $this->originalSlogan);
// Delete the custom field.
$fields = FieldConfig::loadMultiple();
@@ -119,12 +119,12 @@ public function testExportImport() {
$this->drupalPostForm('admin/config/development/configuration/full/import', array('files[import_tarball]' => $filename), 'Upload');
$this->drupalPostForm(NULL, array(), 'Import all');
- $this->assertEqual(\Drupal::config('system.site')->get('slogan'), $this->newSlogan);
+ $this->assertEqual($this->config('system.site')->get('slogan'), $this->newSlogan);
$this->drupalGet('node/add');
$this->assertFieldByName("{$this->fieldName}[0][value]", '', 'Widget is displayed');
- \Drupal::config('system.site')
+ $this->config('system.site')
->set('slogan', $this->originalSlogan)
->save();
$this->drupalGet('admin/config/development/configuration');
diff --git a/core/modules/config/src/Tests/ConfigFileContentTest.php b/core/modules/config/src/Tests/ConfigFileContentTest.php
index 537fdd3..3a62f85 100644
--- a/core/modules/config/src/Tests/ConfigFileContentTest.php
+++ b/core/modules/config/src/Tests/ConfigFileContentTest.php
@@ -56,7 +56,7 @@ function testReadWriteConfig() {
$false_key = 'false';
// Attempt to read non-existing configuration.
- $config = \Drupal::config($name);
+ $config = $this->config($name);
// Verify a configuration object is returned.
$this->assertEqual($config->getName(), $name);
@@ -70,7 +70,7 @@ function testReadWriteConfig() {
$this->assertIdentical($data, FALSE);
// Add a top level value.
- $config = \Drupal::config($name);
+ $config = $this->config($name);
$config->set($key, $value);
// Add a nested value.
@@ -100,7 +100,7 @@ function testReadWriteConfig() {
$this->assertTrue($data);
// Read top level value.
- $config = \Drupal::config($name);
+ $config = $this->config($name);
$this->assertEqual($config->getName(), $name);
$this->assertTrue($config, 'Config object created.');
$this->assertEqual($config->get($key), 'bar', 'Top level configuration value found.');
@@ -138,7 +138,7 @@ function testReadWriteConfig() {
// Unset a nested value.
$config->clear($nested_key);
$config->save();
- $config = \Drupal::config($name);
+ $config = $this->config($name);
// Read unset top level value.
$this->assertNull($config->get($key), 'Top level value unset.');
@@ -147,13 +147,13 @@ function testReadWriteConfig() {
$this->assertNull($config->get($nested_key), 'Nested value unset.');
// Create two new configuration files to test listing.
- $config = \Drupal::config('foo.baz');
+ $config = $this->config('foo.baz');
$config->set($key, $value);
$config->save();
// Test chained set()->save().
$chained_name = 'biff.bang';
- $config = \Drupal::config($chained_name);
+ $config = $this->config($chained_name);
$config->set($key, $value)->save();
// Verify the database entry exists from a chained save.
@@ -181,7 +181,7 @@ function testReadWriteConfig() {
$this->assertEqual($files, array(), 'No files listed with the prefix \'bar\'.');
// Delete the configuration.
- $config = \Drupal::config($name);
+ $config = $this->config($name);
$config->delete();
// Verify the database entry no longer exists.
diff --git a/core/modules/config/src/Tests/ConfigImportAllTest.php b/core/modules/config/src/Tests/ConfigImportAllTest.php
index a7ce00d..de8e607 100644
--- a/core/modules/config/src/Tests/ConfigImportAllTest.php
+++ b/core/modules/config/src/Tests/ConfigImportAllTest.php
@@ -78,7 +78,7 @@ public function testInstallUninstall() {
field_purge_batch(1000);
// Delete any forum terms so it can be uninstalled.
- $vid = \Drupal::config('forum.settings')->get('vocabulary');
+ $vid = $this->config('forum.settings')->get('vocabulary');
$terms = entity_load_multiple_by_properties('taxonomy_term', ['vid' => $vid]);
foreach ($terms as $term) {
$term->delete();
diff --git a/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php b/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php
index ea2face..9341f21 100644
--- a/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php
+++ b/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php
@@ -122,7 +122,7 @@ public function testRenameValidation() {
public function testRenameSimpleConfigValidation() {
$uuid = new Php();
// Create a simple configuration with a UUID.
- $config = \Drupal::config('config_test.new');
+ $config = $this->config('config_test.new');
$uuid_value = $uuid->generate();
$config->set('uuid', $uuid_value)->save();
@@ -132,7 +132,7 @@ public function testRenameSimpleConfigValidation() {
$config->delete();
// Create another simple configuration with the same UUID.
- $config = \Drupal::config('config_test.old');
+ $config = $this->config('config_test.old');
$config->set('uuid', $uuid_value)->save();
// Confirm that the staged configuration is detected as a rename since the
diff --git a/core/modules/config/src/Tests/ConfigImportUITest.php b/core/modules/config/src/Tests/ConfigImportUITest.php
index b868d35..ac9d4bf 100644
--- a/core/modules/config/src/Tests/ConfigImportUITest.php
+++ b/core/modules/config/src/Tests/ConfigImportUITest.php
@@ -67,7 +67,7 @@ function testImport() {
// module is used because it creates a table during the install. The Action
// module is used because it creates a single simple configuration file
// during the install.
- $core_extension = \Drupal::config('core.extension')->get();
+ $core_extension = $this->config('core.extension')->get();
$core_extension['module']['action'] = 0;
$core_extension['module']['ban'] = 0;
$core_extension['module'] = module_config_sort($core_extension['module']);
@@ -81,7 +81,7 @@ function testImport() {
$install_storage = new InstallStorage();
// Set the Bartik theme as default.
- $system_theme = \Drupal::config('system.theme')->get();
+ $system_theme = $this->config('system.theme')->get();
$system_theme['default'] = 'bartik';
$staging->write('system.theme', $system_theme);
@@ -123,10 +123,10 @@ function testImport() {
$this->assertText(t('There are no configuration changes to import.'));
// Verify site name has changed.
- $this->assertIdentical($new_site_name, \Drupal::config('system.site')->get('name'));
+ $this->assertIdentical($new_site_name, $this->config('system.site')->get('name'));
// Verify that new config entity exists.
- $this->assertIdentical($original_dynamic_data, \Drupal::config($dynamic_name)->get());
+ $this->assertIdentical($original_dynamic_data, $this->config($dynamic_name)->get());
// Verify the cache got cleared.
$this->assertTrue(isset($GLOBALS['hook_cache_flush']));
@@ -156,7 +156,7 @@ function testImport() {
$recursion_limit_values = \Drupal::state()->get('ConfigImportUITest.action.settings.recursion_limit', array());
$this->assertIdentical($recursion_limit_values, array(50));
- $core_extension = \Drupal::config('core.extension')->get();
+ $core_extension = $this->config('core.extension')->get();
unset($core_extension['module']['action']);
unset($core_extension['module']['ban']);
unset($core_extension['module']['options']);
@@ -166,7 +166,7 @@ function testImport() {
$staging->delete('action.settings');
$staging->delete('text.settings');
- $system_theme = \Drupal::config('system.theme')->get();
+ $system_theme = $this->config('system.theme')->get();
$system_theme['default'] = 'stark';
$system_theme['admin'] = 'stark';
$staging->write('system.theme', $system_theme);
@@ -234,7 +234,7 @@ function testImportLock() {
$this->container->get('lock.persistent')->release($config_importer::LOCK_NAME);
// Verify site name has not changed.
- $this->assertNotEqual($new_site_name, \Drupal::config('system.site')->get('name'));
+ $this->assertNotEqual($new_site_name, $this->config('system.site')->get('name'));
}
/**
@@ -243,7 +243,7 @@ function testImportLock() {
function testImportSiteUuidValidation() {
$staging = \Drupal::service('config.storage.staging');
// Create updated configuration object.
- $config_data = \Drupal::config('system.site')->get();
+ $config_data = $this->config('system.site')->get();
// Generate a new site UUID.
$config_data['uuid'] = \Drupal::service('uuid')->generate();
$staging->write('system.site', $config_data);
@@ -319,13 +319,13 @@ public function testImportValidation() {
$this->assertText('Config import validate error 2.');
// Verify site name has not changed.
- $this->assertNotEqual($new_site_name, \Drupal::config('system.site')->get('name'));
+ $this->assertNotEqual($new_site_name, $this->config('system.site')->get('name'));
}
public function testConfigUninstallConfigException() {
$staging = $this->container->get('config.storage.staging');
- $core_extension = \Drupal::config('core.extension')->get();
+ $core_extension = $this->config('core.extension')->get();
unset($core_extension['module']['config']);
$staging->write('core.extension', $core_extension);
@@ -340,7 +340,7 @@ public function testConfigUninstallConfigException() {
function prepareSiteNameUpdate($new_site_name) {
$staging = $this->container->get('config.storage.staging');
// Create updated configuration object.
- $config_data = \Drupal::config('system.site')->get();
+ $config_data = $this->config('system.site')->get();
$config_data['name'] = $new_site_name;
$staging->write('system.site', $config_data);
}
diff --git a/core/modules/config/src/Tests/ConfigImporterTest.php b/core/modules/config/src/Tests/ConfigImporterTest.php
index 65efbf5..d2c7cf0 100644
--- a/core/modules/config/src/Tests/ConfigImporterTest.php
+++ b/core/modules/config/src/Tests/ConfigImporterTest.php
@@ -71,10 +71,10 @@ function testNoImport() {
$dynamic_name = 'config_test.dynamic.dotted.default';
// Verify the default configuration values exist.
- $config = \Drupal::config($dynamic_name);
+ $config = $this->config($dynamic_name);
$this->assertIdentical($config->get('id'), 'dotted.default');
- // Verify that a bare \Drupal::config() does not involve module APIs.
+ // Verify that a bare $this->config() does not involve module APIs.
$this->assertFalse(isset($GLOBALS['hook_config_test']));
}
@@ -99,7 +99,7 @@ function testEmptyImportFails() {
function testSiteUuidValidate() {
$staging = \Drupal::service('config.storage.staging');
// Create updated configuration object.
- $config_data = \Drupal::config('system.site')->get();
+ $config_data = $this->config('system.site')->get();
// Generate a new site UUID.
$config_data['uuid'] = \Drupal::service('uuid')->generate();
$staging->write('system.site', $config_data);
@@ -124,7 +124,7 @@ function testDeleted() {
$staging = $this->container->get('config.storage.staging');
// Verify the default configuration values exist.
- $config = \Drupal::config($dynamic_name);
+ $config = $this->config($dynamic_name);
$this->assertIdentical($config->get('id'), 'dotted.default');
// Delete the file from the staging directory.
@@ -136,7 +136,7 @@ function testDeleted() {
// Verify the file has been removed.
$this->assertIdentical($storage->read($dynamic_name), FALSE);
- $config = \Drupal::config($dynamic_name);
+ $config = $this->config($dynamic_name);
$this->assertIdentical($config->get('id'), NULL);
// Verify that appropriate module API hooks have been invoked.
@@ -183,7 +183,7 @@ function testNew() {
$this->configImporter->reset()->import();
// Verify the values appeared.
- $config = \Drupal::config($dynamic_name);
+ $config = $this->config($dynamic_name);
$this->assertIdentical($config->get('label'), $original_dynamic_data['label']);
// Verify that appropriate module API hooks have been invoked.
@@ -494,9 +494,9 @@ function testUpdated() {
$staging->write($dynamic_name, $original_dynamic_data);
// Verify the active configuration still returns the default values.
- $config = \Drupal::config($name);
+ $config = $this->config($name);
$this->assertIdentical($config->get('foo'), 'bar');
- $config = \Drupal::config($dynamic_name);
+ $config = $this->config($dynamic_name);
$this->assertIdentical($config->get('label'), 'Default');
// Import.
@@ -504,9 +504,9 @@ function testUpdated() {
// Verify the values were updated.
\Drupal::configFactory()->reset($name);
- $config = \Drupal::config($name);
+ $config = $this->config($name);
$this->assertIdentical($config->get('foo'), 'beer');
- $config = \Drupal::config($dynamic_name);
+ $config = $this->config($dynamic_name);
$this->assertIdentical($config->get('label'), 'Updated');
// Verify that the original file content is still the same.
diff --git a/core/modules/config/src/Tests/ConfigInstallTest.php b/core/modules/config/src/Tests/ConfigInstallTest.php
index 01c3bd8..e21d7c8 100644
--- a/core/modules/config/src/Tests/ConfigInstallTest.php
+++ b/core/modules/config/src/Tests/ConfigInstallTest.php
@@ -33,9 +33,9 @@ function testModuleInstallation() {
$default_configuration_entity = 'config_test.dynamic.dotted.default';
// Verify that default module config does not exist before installation yet.
- $config = \Drupal::config($default_config);
+ $config = $this->config($default_config);
$this->assertIdentical($config->isNew(), TRUE);
- $config = \Drupal::config($default_configuration_entity);
+ $config = $this->config($default_configuration_entity);
$this->assertIdentical($config->isNew(), TRUE);
// Ensure that schema provided by modules that are not installed is not
@@ -52,9 +52,9 @@ function testModuleInstallation() {
// Verify that default module config exists.
\Drupal::configFactory()->reset($default_config);
\Drupal::configFactory()->reset($default_configuration_entity);
- $config = \Drupal::config($default_config);
+ $config = $this->config($default_config);
$this->assertIdentical($config->isNew(), FALSE);
- $config = \Drupal::config($default_configuration_entity);
+ $config = $this->config($default_configuration_entity);
$this->assertIdentical($config->isNew(), FALSE);
// Verify that config_test API hooks were invoked for the dynamic default
@@ -67,11 +67,11 @@ function testModuleInstallation() {
$this->assertFalse(isset($GLOBALS['hook_config_test']['delete']));
// Ensure that data type casting is applied during config installation.
- $config = \Drupal::config('config_schema_test.schema_in_install');
+ $config = $this->config('config_schema_test.schema_in_install');
$this->assertIdentical($config->get('integer'), 1);
// Test that uninstalling configuration removes configuration schema.
- \Drupal::config('core.extension')->set('module', array())->save();
+ $this->config('core.extension')->set('module', array())->save();
\Drupal::service('config.manager')->uninstall('module', 'config_test');
$this->assertFalse(\Drupal::service('config.typed')->hasConfigSchema('config_schema_test.schema_in_install'), 'Configuration schema for config_schema_test.schema_in_install does not exist.');
}
diff --git a/core/modules/config/src/Tests/ConfigInstallWebTest.php b/core/modules/config/src/Tests/ConfigInstallWebTest.php
index 190e752..5212973 100644
--- a/core/modules/config/src/Tests/ConfigInstallWebTest.php
+++ b/core/modules/config/src/Tests/ConfigInstallWebTest.php
@@ -37,9 +37,9 @@ function testIntegrationModuleReinstallation() {
\Drupal::service('module_installer')->install(array('config_test'));
// Verify the configuration does not exist prior to installation.
- $config_static = \Drupal::config($default_config);
+ $config_static = $this->config($default_config);
$this->assertIdentical($config_static->isNew(), TRUE);
- $config_entity = \Drupal::config($default_configuration_entity);
+ $config_entity = $this->config($default_configuration_entity);
$this->assertIdentical($config_entity->isNew(), TRUE);
// Install the integration module.
@@ -48,10 +48,10 @@ function testIntegrationModuleReinstallation() {
// Verify that default module config exists.
\Drupal::configFactory()->reset($default_config);
\Drupal::configFactory()->reset($default_configuration_entity);
- $config_static = \Drupal::config($default_config);
+ $config_static = $this->config($default_config);
$this->assertIdentical($config_static->isNew(), FALSE);
$this->assertIdentical($config_static->get('foo'), 'default setting');
- $config_entity = \Drupal::config($default_configuration_entity);
+ $config_entity = $this->config($default_configuration_entity);
$this->assertIdentical($config_entity->isNew(), FALSE);
$this->assertIdentical($config_entity->get('label'), 'Default integration config label');
@@ -60,7 +60,7 @@ function testIntegrationModuleReinstallation() {
$config_entity->set('label', 'Customized integration config label')->save();
// @todo FIXME: Setting config keys WITHOUT SAVING retains the changed config
- // object in memory. Every new call to \Drupal::config() MUST revert in-memory changes
+ // object in memory. Every new call to $this->config() MUST revert in-memory changes
// that haven't been saved!
// In other words: This test passes even without this reset, but it shouldn't.
$this->container->get('config.factory')->reset();
@@ -69,11 +69,11 @@ function testIntegrationModuleReinstallation() {
$this->container->get('module_installer')->uninstall(array('config_integration_test'));
// Verify the integration module's config was uninstalled.
- $config_static = \Drupal::config($default_config);
+ $config_static = $this->config($default_config);
$this->assertIdentical($config_static->isNew(), TRUE);
// Verify the integration config still exists.
- $config_entity = \Drupal::config($default_configuration_entity);
+ $config_entity = $this->config($default_configuration_entity);
$this->assertIdentical($config_entity->isNew(), FALSE);
$this->assertIdentical($config_entity->get('label'), 'Customized integration config label');
@@ -83,12 +83,12 @@ function testIntegrationModuleReinstallation() {
// Verify the integration module's config was re-installed.
\Drupal::configFactory()->reset($default_config);
\Drupal::configFactory()->reset($default_configuration_entity);
- $config_static = \Drupal::config($default_config);
+ $config_static = $this->config($default_config);
$this->assertIdentical($config_static->isNew(), FALSE);
$this->assertIdentical($config_static->get('foo'), 'default setting');
// Verify the customized integration config still exists.
- $config_entity = \Drupal::config($default_configuration_entity);
+ $config_entity = $this->config($default_configuration_entity);
$this->assertIdentical($config_entity->isNew(), FALSE);
$this->assertIdentical($config_entity->get('label'), 'Customized integration config label');
}
@@ -126,7 +126,7 @@ function testInstallProfileConfigOverwrite() {
// Verify that active configuration matches the expected data, which was
// created from the testing install profile's system.cron.yml file.
- $config = \Drupal::config($config_name);
+ $config = $this->config($config_name);
$this->assertIdentical($config->get(), $expected_profile_data);
// Turn on the test module, which will attempt to replace the
@@ -136,14 +136,14 @@ function testInstallProfileConfigOverwrite() {
$this->assertTrue($status, "The module config_existing_default_config_test was installed.");
// Verify that the test module has not been able to change the data.
- $config = \Drupal::config($config_name);
+ $config = $this->config($config_name);
$this->assertIdentical($config->get(), $expected_profile_data);
// Disable and uninstall the test module.
\Drupal::service('module_installer')->uninstall(array('config_existing_default_config_test'));
// Verify that the data hasn't been altered by removing the test module.
- $config = \Drupal::config($config_name);
+ $config = $this->config($config_name);
$this->assertIdentical($config->get(), $expected_profile_data);
}
}
diff --git a/core/modules/config/src/Tests/ConfigLanguageOverrideWebTest.php b/core/modules/config/src/Tests/ConfigLanguageOverrideWebTest.php
index be24fb9..b072b63 100644
--- a/core/modules/config/src/Tests/ConfigLanguageOverrideWebTest.php
+++ b/core/modules/config/src/Tests/ConfigLanguageOverrideWebTest.php
@@ -67,7 +67,7 @@ function testSiteNameTranslation() {
// overrides still work.
$language_manager = \Drupal::languageManager()->reset();
$this->assertTrue($language_manager->isMultilingual(), 'The test site is multilingual.');
- \Drupal::config('system.site')->set('langcode', 'xx')->save();
+ $this->config('system.site')->set('langcode', 'xx')->save();
ConfigurableLanguage::load('en')->delete();
$this->assertFalse($language_manager->isMultilingual(), 'The test site is monolingual.');
diff --git a/core/modules/config/src/Tests/ConfigModuleOverridesTest.php b/core/modules/config/src/Tests/ConfigModuleOverridesTest.php
index 3a663d5..905b446 100644
--- a/core/modules/config/src/Tests/ConfigModuleOverridesTest.php
+++ b/core/modules/config/src/Tests/ConfigModuleOverridesTest.php
@@ -53,7 +53,7 @@ public function testSimpleModuleOverrides() {
$this->assertTrue($config->isNew(), 'The configuration object config_override_test.new is new');
$this->assertIdentical($config->get('module'), 'override');
$config_factory->setOverrideState(FALSE);
- $config = \Drupal::config('config_override_test.new');
+ $config = $this->config('config_override_test.new');
$this->assertIdentical($config->get('module'), NULL);
$config_factory->setOverrideState($old_state);
diff --git a/core/modules/config/src/Tests/ConfigSchemaTest.php b/core/modules/config/src/Tests/ConfigSchemaTest.php
index 202b552..fc18cfa 100644
--- a/core/modules/config/src/Tests/ConfigSchemaTest.php
+++ b/core/modules/config/src/Tests/ConfigSchemaTest.php
@@ -356,16 +356,16 @@ public function testConfigSaveWithSchema() {
);
// Save config which has a schema that enforces types.
- \Drupal::config('config_schema_test.schema_data_types')
+ $this->config('config_schema_test.schema_data_types')
->setData($untyped_to_typed)
->save();
- $this->assertIdentical(\Drupal::config('config_schema_test.schema_data_types')->get(), $typed_values);
+ $this->assertIdentical($this->config('config_schema_test.schema_data_types')->get(), $typed_values);
// Save config which does not have a schema that enforces types.
- \Drupal::config('config_schema_test.no_schema_data_types')
+ $this->config('config_schema_test.no_schema_data_types')
->setData($untyped_values)
->save();
- $this->assertIdentical(\Drupal::config('config_schema_test.no_schema_data_types')->get(), $untyped_values);
+ $this->assertIdentical($this->config('config_schema_test.no_schema_data_types')->get(), $untyped_values);
// Ensure that configuration objects with keys marked as ignored are not
// changed when saved. The 'config_schema_test.ignore' will have been saved
@@ -373,7 +373,7 @@ public function testConfigSaveWithSchema() {
$extension_path = drupal_get_path('module', 'config_schema_test');
$install_storage = new FileStorage($extension_path . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY);
$original_data = $install_storage->read('config_schema_test.ignore');
- $this->assertIdentical(\Drupal::config('config_schema_test.ignore')->get(), $original_data);
+ $this->assertIdentical($this->config('config_schema_test.ignore')->get(), $original_data);
}
/**
diff --git a/core/modules/config/src/Tests/ConfigSingleImportExportTest.php b/core/modules/config/src/Tests/ConfigSingleImportExportTest.php
index 7221be4..8fc7e6a 100644
--- a/core/modules/config/src/Tests/ConfigSingleImportExportTest.php
+++ b/core/modules/config/src/Tests/ConfigSingleImportExportTest.php
@@ -125,7 +125,7 @@ public function testImport() {
*/
public function testImportSimpleConfiguration() {
$this->drupalLogin($this->drupalCreateUser(array('import configuration')));
- $config = \Drupal::config('system.site')->set('name', 'Test simple import');
+ $config = $this->config('system.site')->set('name', 'Test simple import');
$edit = array(
'config_type' => 'system.simple',
'config_name' => $config->getName(),
diff --git a/core/modules/config/src/Tests/ConfigSnapshotTest.php b/core/modules/config/src/Tests/ConfigSnapshotTest.php
index b3789d6..e8ec6d7 100644
--- a/core/modules/config/src/Tests/ConfigSnapshotTest.php
+++ b/core/modules/config/src/Tests/ConfigSnapshotTest.php
@@ -64,7 +64,7 @@ function testSnapshot() {
$this->assertFalse($active_snapshot_comparer->reset()->hasChanges());
// Change a configuration value in staging.
- $staging_data = \Drupal::config($config_name)->get();
+ $staging_data = $this->config($config_name)->get();
$staging_data[$config_key] = $new_data;
$staging->write($config_name, $staging_data);
@@ -78,7 +78,7 @@ function testSnapshot() {
// Verify changed config was properly imported.
\Drupal::configFactory()->reset($config_name);
- $this->assertIdentical(\Drupal::config($config_name)->get($config_key), $new_data);
+ $this->assertIdentical($this->config($config_name)->get($config_key), $new_data);
// Verify that a new snapshot was created which and that it matches
// the active config.
diff --git a/core/modules/config/src/Tests/SchemaCheckTestTrait.php b/core/modules/config/src/Tests/SchemaCheckTestTrait.php
index f4e22b2..9f7cf2a 100644
--- a/core/modules/config/src/Tests/SchemaCheckTestTrait.php
+++ b/core/modules/config/src/Tests/SchemaCheckTestTrait.php
@@ -57,7 +57,7 @@ public function assertConfigSchema(TypedConfigManagerInterface $typed_config, $c
* The configuration name.
*/
public function assertConfigSchemaByName($config_name) {
- $config = \Drupal::config($config_name);
+ $config = $this->config($config_name);
$this->assertConfigSchema(\Drupal::service('config.typed'), $config->getName(), $config->get());
}
diff --git a/core/modules/config/src/Tests/SchemaCheckTraitTest.php b/core/modules/config/src/Tests/SchemaCheckTraitTest.php
index a622db8..c0de5d7 100644
--- a/core/modules/config/src/Tests/SchemaCheckTraitTest.php
+++ b/core/modules/config/src/Tests/SchemaCheckTraitTest.php
@@ -48,11 +48,11 @@ protected function setUp() {
*/
public function testTrait() {
// Test a non existing schema.
- $ret = $this->checkConfigSchema($this->typedConfig, 'config_schema_test.noschema', \Drupal::config('config_schema_test.noschema')->get());
+ $ret = $this->checkConfigSchema($this->typedConfig, 'config_schema_test.noschema', $this->config('config_schema_test.noschema')->get());
$this->assertIdentical($ret, FALSE);
// Test an existing schema with valid data.
- $config_data = \Drupal::config('config_test.types')->get();
+ $config_data = $this->config('config_test.types')->get();
$ret = $this->checkConfigSchema($this->typedConfig, 'config_test.types', $config_data);
$this->assertIdentical($ret, TRUE);
diff --git a/core/modules/config/src/Tests/SchemaConfigListenerTest.php b/core/modules/config/src/Tests/SchemaConfigListenerTest.php
index 79d9208..bac6245 100644
--- a/core/modules/config/src/Tests/SchemaConfigListenerTest.php
+++ b/core/modules/config/src/Tests/SchemaConfigListenerTest.php
@@ -30,7 +30,7 @@ public function testConfigSchemaChecker() {
// Test a non-existing schema.
$message = 'Expected SchemaIncompleteException thrown';
try {
- \Drupal::config('config_schema_test.schemaless')->set('foo', 'bar')->save();
+ $this->config('config_schema_test.schemaless')->set('foo', 'bar')->save();
$this->fail($message);
}
catch (SchemaIncompleteException $e) {
@@ -40,7 +40,7 @@ public function testConfigSchemaChecker() {
// Test a valid schema.
$message = 'Unexpected SchemaIncompleteException thrown';
- $config = \Drupal::config('config_test.types')->set('int', 10);
+ $config = $this->config('config_test.types')->set('int', 10);
try {
$config->save();
$this->pass($message);
@@ -51,7 +51,7 @@ public function testConfigSchemaChecker() {
// Test an invalid schema.
$message = 'Expected SchemaIncompleteException thrown';
- $config = \Drupal::config('config_test.types')
+ $config = $this->config('config_test.types')
->set('foo', 'bar')
->set('array', 1);
try {
diff --git a/core/modules/config/src/Tests/SchemaConfigListenerWebTest.php b/core/modules/config/src/Tests/SchemaConfigListenerWebTest.php
index 01a1cf8..1677214 100644
--- a/core/modules/config/src/Tests/SchemaConfigListenerWebTest.php
+++ b/core/modules/config/src/Tests/SchemaConfigListenerWebTest.php
@@ -31,7 +31,7 @@ public function testConfigSchemaChecker() {
// Test a non-existing schema.
$msg = 'Expected SchemaIncompleteException thrown';
try {
- \Drupal::config('config_schema_test.schemaless')->set('foo', 'bar')->save();
+ $this->config('config_schema_test.schemaless')->set('foo', 'bar')->save();
$this->fail($msg);
}
catch (SchemaIncompleteException $e) {
@@ -41,7 +41,7 @@ public function testConfigSchemaChecker() {
// Test a valid schema.
$msg = 'Unexpected SchemaIncompleteException thrown';
- $config = \Drupal::config('config_test.types')->set('int', 10);
+ $config = $this->config('config_test.types')->set('int', 10);
try {
$config->save();
$this->pass($msg);
@@ -52,7 +52,7 @@ public function testConfigSchemaChecker() {
// Test an invalid schema.
$msg = 'Expected SchemaIncompleteException thrown';
- $config = \Drupal::config('config_test.types')
+ $config = $this->config('config_test.types')
->set('foo', 'bar')
->set('array', 1);
try {
diff --git a/core/modules/config/src/Tests/Storage/FileStorageTest.php b/core/modules/config/src/Tests/Storage/FileStorageTest.php
index 019aa34..6736bc3 100644
--- a/core/modules/config/src/Tests/Storage/FileStorageTest.php
+++ b/core/modules/config/src/Tests/Storage/FileStorageTest.php
@@ -22,7 +22,7 @@ protected function setUp() {
$this->invalidStorage = new FileStorage($this->configDirectories[CONFIG_ACTIVE_DIRECTORY] . '/nonexisting');
// FileStorage::listAll() requires other configuration data to exist.
- $this->storage->write('system.performance', \Drupal::config('system.performance')->get());
+ $this->storage->write('system.performance', $this->config('system.performance')->get());
$this->storage->write('core.extension', array('module' => array()));
}
diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php
index 88e60ac..999ebb5 100644
--- a/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php
+++ b/core/modules/config_translation/src/Tests/ConfigTranslationListUiTest.php
@@ -77,7 +77,7 @@ protected function setUp() {
// Enable import of translations. By default this is disabled for automated
// tests.
- \Drupal::config('locale.settings')
+ $this->config('locale.settings')
->set('translation.import_enabled', TRUE)
->save();
}
diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
index d15d8f3..35bfabe 100644
--- a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
+++ b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php
@@ -583,7 +583,7 @@ public function testViewsTranslationUI() {
public function testLocaleDBStorage() {
// Enable import of translations. By default this is disabled for automated
// tests.
- \Drupal::config('locale.settings')
+ $this->config('locale.settings')
->set('translation.import_enabled', TRUE)
->save();
diff --git a/core/modules/contact/src/Tests/ContactPersonalTest.php b/core/modules/contact/src/Tests/ContactPersonalTest.php
index b92ad85..340c281 100644
--- a/core/modules/contact/src/Tests/ContactPersonalTest.php
+++ b/core/modules/contact/src/Tests/ContactPersonalTest.php
@@ -53,7 +53,7 @@ protected function setUp() {
$this->adminUser = $this->drupalCreateUser(array('administer contact forms', 'administer users', 'administer account settings', 'access site reports'));
// Create some normal users with their contact forms enabled by default.
- \Drupal::config('contact.settings')->set('user_default_enabled', TRUE)->save();
+ $this->config('contact.settings')->set('user_default_enabled', TRUE)->save();
$this->webUser = $this->drupalCreateUser(array('access user contact forms'));
$this->contactUser = $this->drupalCreateUser();
}
@@ -69,11 +69,11 @@ function testSendPersonalContactMessage() {
$this->assertEqual(1, count($mails));
$mail = $mails[0];
$this->assertEqual($mail['to'], $this->contactUser->getEmail());
- $this->assertEqual($mail['from'], \Drupal::config('system.site')->get('mail'));
+ $this->assertEqual($mail['from'], $this->config('system.site')->get('mail'));
$this->assertEqual($mail['reply-to'], $this->webUser->getEmail());
$this->assertEqual($mail['key'], 'user_mail');
$variables = array(
- '!site-name' => \Drupal::config('system.site')->get('name'),
+ '!site-name' => $this->config('system.site')->get('name'),
'!subject' => $message['subject[0][value]'],
'!recipient-name' => $this->contactUser->getUsername(),
);
@@ -192,7 +192,7 @@ function testPersonalContactAccess() {
*/
function testPersonalContactFlood() {
$flood_limit = 3;
- \Drupal::config('contact.settings')->set('flood.limit', $flood_limit)->save();
+ $this->config('contact.settings')->set('flood.limit', $flood_limit)->save();
// Clear flood table in preparation for flood test and allow other checks to complete.
db_delete('flood')->execute();
@@ -209,7 +209,7 @@ function testPersonalContactFlood() {
// Submit contact form one over limit.
$this->drupalGet('user/' . $this->contactUser->id(). '/contact');
- $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => $flood_limit, '@interval' => \Drupal::service('date.formatter')->formatInterval(\Drupal::config('contact.settings')->get('flood.interval')))), 'Normal user denied access to flooded contact form.');
+ $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => $flood_limit, '@interval' => \Drupal::service('date.formatter')->formatInterval($this->config('contact.settings')->get('flood.interval')))), 'Normal user denied access to flooded contact form.');
// Test that the admin user can still access the contact form even though
// the flood limit was reached.
@@ -224,7 +224,7 @@ function testAdminContact() {
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access user contact forms'));
$this->checkContactAccess(200);
$this->checkContactAccess(403, FALSE);
- $config = \Drupal::config('contact.settings');
+ $config = $this->config('contact.settings');
$config->set('user_default_enabled', FALSE);
$config->save();
$this->checkContactAccess(403);
@@ -241,7 +241,7 @@ function testAdminContact() {
protected function checkContactAccess($response, $contact_value = NULL) {
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/people/create');
- if (\Drupal::config('contact.settings')->get('user_default_enabled', TRUE)) {
+ if ($this->config('contact.settings')->get('user_default_enabled', TRUE)) {
$this->assertFieldChecked('edit-contact--2');
}
else {
diff --git a/core/modules/contact/src/Tests/ContactSitewideTest.php b/core/modules/contact/src/Tests/ContactSitewideTest.php
index 1909a46..66176c4 100644
--- a/core/modules/contact/src/Tests/ContactSitewideTest.php
+++ b/core/modules/contact/src/Tests/ContactSitewideTest.php
@@ -45,7 +45,7 @@ function testSiteWideContact() {
$this->drupalLogin($admin_user);
$flood_limit = 3;
- \Drupal::config('contact.settings')
+ $this->config('contact.settings')
->set('flood.limit', $flood_limit)
->set('flood.interval', 600)
->save();
@@ -122,7 +122,7 @@ function testSiteWideContact() {
$this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
// Check that the form was created in site default language.
- $langcode = \Drupal::config('contact.form.' . $id)->get('langcode');
+ $langcode = $this->config('contact.form.' . $id)->get('langcode');
$default_langcode = \Drupal::languageManager()->getDefaultLanguage()->getId();
$this->assertEqual($langcode, $default_langcode);
@@ -131,18 +131,18 @@ function testSiteWideContact() {
// Test update contact form.
$this->updateContactForm($id, $label = $this->randomMachineName(16), $recipients_str = implode(',', array($recipients[0], $recipients[1])), $reply = $this->randomMachineName(30), FALSE);
- $config = \Drupal::config('contact.form.' . $id)->get();
+ $config = $this->config('contact.form.' . $id)->get();
$this->assertEqual($config['label'], $label);
$this->assertEqual($config['recipients'], array($recipients[0], $recipients[1]));
$this->assertEqual($config['reply'], $reply);
- $this->assertNotEqual($id, \Drupal::config('contact.settings')->get('default_form'));
+ $this->assertNotEqual($id, $this->config('contact.settings')->get('default_form'));
$this->assertRaw(t('Contact form %label has been updated.', array('%label' => $label)));
// Ensure the label is displayed on the contact page for this form.
$this->drupalGet('contact/' . $id);
$this->assertText($label);
// Reset the form back to be the default form.
- \Drupal::config('contact.settings')->set('default_form', $id)->save();
+ $this->config('contact.settings')->set('default_form', $id)->save();
// Ensure that the contact form is shown without a form selection input.
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form'));
@@ -197,7 +197,7 @@ function testSiteWideContact() {
$this->assertText(t('Message field is required.'));
// Test contact form with no default form selected.
- \Drupal::config('contact.settings')
+ $this->config('contact.settings')
->set('default_form', '')
->save();
$this->drupalGet('contact');
@@ -217,7 +217,7 @@ function testSiteWideContact() {
// Submit contact form one over limit.
$this->drupalGet('contact');
$this->assertResponse(403);
- $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => \Drupal::config('contact.settings')->get('flood.limit'), '@interval' => \Drupal::service('date.formatter')->formatInterval(600))));
+ $this->assertRaw(t('You cannot send more than %number messages in @interval. Try again later.', array('%number' => $this->config('contact.settings')->get('flood.limit'), '@interval' => \Drupal::service('date.formatter')->formatInterval(600))));
// Test listing controller.
$this->drupalLogin($admin_user);
@@ -391,7 +391,7 @@ function submitContact($name, $mail, $subject, $id, $message) {
$edit['mail'] = $mail;
$edit['subject[0][value]'] = $subject;
$edit['message[0][value]'] = $message;
- if ($id == \Drupal::config('contact.settings')->get('default_form')) {
+ if ($id == $this->config('contact.settings')->get('default_form')) {
$this->drupalPostForm('contact', $edit, t('Send message'));
}
else {
diff --git a/core/modules/contact/src/Tests/ContactStorageTest.php b/core/modules/contact/src/Tests/ContactStorageTest.php
index 36edbd9..0110bb0 100644
--- a/core/modules/contact/src/Tests/ContactStorageTest.php
+++ b/core/modules/contact/src/Tests/ContactStorageTest.php
@@ -68,7 +68,7 @@ public function testContactStorage() {
$this->assertEqual($message->getSubject(), $subject);
$this->assertEqual($message->getSenderMail(), $mail);
- $config = \Drupal::config("contact.form.$id");
+ $config = $this->config("contact.form.$id");
$this->assertEqual($config->get('id'), $id);
}
diff --git a/core/modules/dblog/src/Tests/DbLogTest.php b/core/modules/dblog/src/Tests/DbLogTest.php
index ec34a6c..72be622 100644
--- a/core/modules/dblog/src/Tests/DbLogTest.php
+++ b/core/modules/dblog/src/Tests/DbLogTest.php
@@ -95,7 +95,7 @@ private function verifyRowLimit($row_limit) {
$this->assertResponse(200);
// Check row limit variable.
- $current_limit = \Drupal::config('dblog.settings')->get('row_limit');
+ $current_limit = $this->config('dblog.settings')->get('row_limit');
$this->assertTrue($current_limit == $row_limit, format_string('[Cache] Row limit variable of @count equals row limit of @limit', array('@count' => $current_limit, '@limit' => $row_limit)));
}
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php
index 3ccc842..2a5d1b6 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php
@@ -99,9 +99,9 @@ function testEntityReferenceDefaultValue() {
$this->assertEqual($new_node->get($field_name)->offsetGet(0)->target_id, $referenced_node->id());
// Ensure that the entity reference config schemas are correct.
- $field_config = \Drupal::config('field.field.node.reference_content.' . $field_name);
+ $field_config = $this->config('field.field.node.reference_content.' . $field_name);
$this->assertConfigSchema(\Drupal::service('config.typed'), $field_config->getName(), $field_config->get());
- $field_storage_config = \Drupal::config('field.storage.node.' . $field_name);
+ $field_storage_config = $this->config('field.storage.node.' . $field_name);
$this->assertConfigSchema(\Drupal::service('config.typed'), $field_storage_config->getName(), $field_storage_config->get());
}
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceSelectionAccessTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceSelectionAccessTest.php
index a6edb35..591e619 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceSelectionAccessTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceSelectionAccessTest.php
@@ -242,7 +242,7 @@ public function testUserHandler() {
),
);
- $user_values['anonymous']->name = \Drupal::config('user.settings')->get('anonymous');
+ $user_values['anonymous']->name = $this->config('user.settings')->get('anonymous');
$users = array();
$user_labels = array();
diff --git a/core/modules/field/src/Tests/FieldCrudTest.php b/core/modules/field/src/Tests/FieldCrudTest.php
index 6fe8316..8806a53 100644
--- a/core/modules/field/src/Tests/FieldCrudTest.php
+++ b/core/modules/field/src/Tests/FieldCrudTest.php
@@ -74,7 +74,7 @@ function testCreateField() {
// Read the configuration. Check against raw configuration data rather than
// the loaded ConfigEntity, to be sure we check that the defaults are
// applied on write.
- $config = \Drupal::config('field.field.' . $field->id())->get();
+ $config = $this->config('field.field.' . $field->id())->get();
$field_type_manager = \Drupal::service('plugin.manager.field.field_type');
// Check that default values are set.
diff --git a/core/modules/field/src/Tests/FieldImportDeleteUninstallTest.php b/core/modules/field/src/Tests/FieldImportDeleteUninstallTest.php
index 188cceb..3e83c4d 100644
--- a/core/modules/field/src/Tests/FieldImportDeleteUninstallTest.php
+++ b/core/modules/field/src/Tests/FieldImportDeleteUninstallTest.php
@@ -86,7 +86,7 @@ public function testImportDeleteUninstall() {
$this->copyConfig($active, $staging);
// Stage uninstall of the Telephone module.
- $core_extension = \Drupal::config('core.extension')->get();
+ $core_extension = $this->config('core.extension')->get();
unset($core_extension['module']['telephone']);
$staging->write('core.extension', $core_extension);
@@ -148,7 +148,7 @@ public function testImportAlreadyDeletedUninstall() {
$this->copyConfig($active, $staging);
// Stage uninstall of the Telephone module.
- $core_extension = \Drupal::config('core.extension')->get();
+ $core_extension = $this->config('core.extension')->get();
unset($core_extension['module']['telephone']);
$staging->write('core.extension', $core_extension);
diff --git a/core/modules/field/src/Tests/FieldImportDeleteUninstallUiTest.php b/core/modules/field/src/Tests/FieldImportDeleteUninstallUiTest.php
index 939cfc4..d10b146 100644
--- a/core/modules/field/src/Tests/FieldImportDeleteUninstallUiTest.php
+++ b/core/modules/field/src/Tests/FieldImportDeleteUninstallUiTest.php
@@ -84,7 +84,7 @@ public function testImportDeleteUninstall() {
$this->copyConfig($active, $staging);
// Stage uninstall of the Telephone module.
- $core_extension = \Drupal::config('core.extension')->get();
+ $core_extension = $this->config('core.extension')->get();
unset($core_extension['module']['telephone']);
$staging->write('core.extension', $core_extension);
diff --git a/core/modules/field/src/Tests/FieldStorageCrudTest.php b/core/modules/field/src/Tests/FieldStorageCrudTest.php
index c72e63d..94fb1d2 100644
--- a/core/modules/field/src/Tests/FieldStorageCrudTest.php
+++ b/core/modules/field/src/Tests/FieldStorageCrudTest.php
@@ -51,7 +51,7 @@ function testCreate() {
// Read the configuration. Check against raw configuration data rather than
// the loaded ConfigEntity, to be sure we check that the defaults are
// applied on write.
- $field_storage_config = \Drupal::config('field.storage.' . $field_storage->id())->get();
+ $field_storage_config = $this->config('field.storage.' . $field_storage->id())->get();
// Ensure that basic properties are preserved.
$this->assertEqual($field_storage_config['field_name'], $field_storage_definition['field_name'], 'The field name is properly saved.');
diff --git a/core/modules/field/src/Tests/FormTest.php b/core/modules/field/src/Tests/FormTest.php
index 9274624..e8b1323 100644
--- a/core/modules/field/src/Tests/FormTest.php
+++ b/core/modules/field/src/Tests/FormTest.php
@@ -103,7 +103,7 @@ function testFieldFormSingle() {
$this->drupalGet('entity_test/add');
// Create token value expected for description.
- $token_description = String::checkPlain(\Drupal::config('system.site')->get('name')) . '_description';
+ $token_description = String::checkPlain($this->config('system.site')->get('name')) . '_description';
$this->assertText($token_description, 'Token replacement for description is displayed');
$this->assertFieldByName("{$field_name}[0][value]", '', 'Widget is displayed');
$this->assertNoField("{$field_name}[1][value]", 'No extraneous widget is displayed');
diff --git a/core/modules/field_ui/src/Tests/EntityDisplayTest.php b/core/modules/field_ui/src/Tests/EntityDisplayTest.php
index 2f47234..0db126a 100644
--- a/core/modules/field_ui/src/Tests/EntityDisplayTest.php
+++ b/core/modules/field_ui/src/Tests/EntityDisplayTest.php
@@ -242,7 +242,7 @@ public function testBaseFieldComponent() {
// Check that saving the display only writes data for fields whose display
// is configurable.
$display->save();
- $config = \Drupal::config('core.entity_view_display.' . $display->id());
+ $config = $this->config('core.entity_view_display.' . $display->id());
$data = $config->get();
$this->assertFalse(isset($data['content']['test_no_display']));
$this->assertFalse(isset($data['hidden']['test_no_display']));
diff --git a/core/modules/field_ui/src/Tests/EntityFormDisplayTest.php b/core/modules/field_ui/src/Tests/EntityFormDisplayTest.php
index 057d575..b7f5032 100644
--- a/core/modules/field_ui/src/Tests/EntityFormDisplayTest.php
+++ b/core/modules/field_ui/src/Tests/EntityFormDisplayTest.php
@@ -146,7 +146,7 @@ public function testBaseFieldComponent() {
// Check that saving the display only writes data for fields whose display
// is configurable.
$display->save();
- $config = \Drupal::config('core.entity_form_display.' . $display->id());
+ $config = $this->config('core.entity_form_display.' . $display->id());
$data = $config->get();
$this->assertFalse(isset($data['content']['test_no_display']));
$this->assertFalse(isset($data['hidden']['test_no_display']));
diff --git a/core/modules/field_ui/src/Tests/ManageFieldsTest.php b/core/modules/field_ui/src/Tests/ManageFieldsTest.php
index 335b63b..9efd340 100644
--- a/core/modules/field_ui/src/Tests/ManageFieldsTest.php
+++ b/core/modules/field_ui/src/Tests/ManageFieldsTest.php
@@ -287,7 +287,7 @@ function assertFieldSettings($bundle, $field_name, $string = 'dummy test string'
function testFieldPrefix() {
// Change default field prefix.
$field_prefix = strtolower($this->randomMachineName(10));
- \Drupal::config('field_ui.settings')->set('field_prefix', $field_prefix)->save();
+ $this->config('field_ui.settings')->set('field_prefix', $field_prefix)->save();
// Create a field input and label exceeding the new maxlength, which is 22.
$field_exceed_max_length_label = $this->randomString(23);
@@ -422,7 +422,7 @@ function testDeleteField() {
*/
function testDisallowedFieldNames() {
// Reset the field prefix so we can test properly.
- \Drupal::config('field_ui.settings')->set('field_prefix', '')->save();
+ $this->config('field_ui.settings')->set('field_prefix', '')->save();
$label = 'Disallowed field';
$edit = array(
diff --git a/core/modules/file/src/Tests/DownloadTest.php b/core/modules/file/src/Tests/DownloadTest.php
index ac81651..84243a3 100644
--- a/core/modules/file/src/Tests/DownloadTest.php
+++ b/core/modules/file/src/Tests/DownloadTest.php
@@ -56,7 +56,7 @@ public function testPrivateFileTransferWithoutPageCache() {
*/
public function testPrivateFileTransferWithPageCache() {
// Turn on page caching and rerun the test.
- $config = \Drupal::config('system.performance');
+ $config = $this->config('system.performance');
$config->set('cache.page.use_internal', 1);
$config->set('cache.page.max_age', 300);
$config->save();
diff --git a/core/modules/file/src/Tests/RemoteFileSaveUploadTest.php b/core/modules/file/src/Tests/RemoteFileSaveUploadTest.php
index 81f4340..59313bc 100644
--- a/core/modules/file/src/Tests/RemoteFileSaveUploadTest.php
+++ b/core/modules/file/src/Tests/RemoteFileSaveUploadTest.php
@@ -23,6 +23,6 @@ class RemoteFileSaveUploadTest extends SaveUploadTest {
protected function setUp() {
parent::setUp();
- \Drupal::config('system.file')->set('default_scheme', 'dummy-remote')->save();
+ $this->config('system.file')->set('default_scheme', 'dummy-remote')->save();
}
}
diff --git a/core/modules/file/src/Tests/SaveUploadTest.php b/core/modules/file/src/Tests/SaveUploadTest.php
index 30e681d..3b34f91 100644
--- a/core/modules/file/src/Tests/SaveUploadTest.php
+++ b/core/modules/file/src/Tests/SaveUploadTest.php
@@ -173,7 +173,7 @@ function testHandleExtension() {
* Test dangerous file handling.
*/
function testHandleDangerousFile() {
- $config = \Drupal::config('system.file');
+ $config = $this->config('system.file');
// Allow the .php extension and make sure it gets renamed to .txt for
// safety. Also check to make sure its MIME type was changed.
$edit = array(
@@ -217,7 +217,7 @@ function testHandleDangerousFile() {
*/
function testHandleFileMunge() {
// Ensure insecure uploads are disabled for this test.
- \Drupal::config('system.file')->set('allow_insecure_uploads', 0)->save();
+ $this->config('system.file')->set('allow_insecure_uploads', 0)->save();
$this->image = file_move($this->image, $this->image->getFileUri() . '.foo.' . $this->image_extension);
// Reset the hook counters to get rid of the 'move' we just called.
diff --git a/core/modules/file/src/Tests/UsageTest.php b/core/modules/file/src/Tests/UsageTest.php
index d251bec..ba5b3b3 100644
--- a/core/modules/file/src/Tests/UsageTest.php
+++ b/core/modules/file/src/Tests/UsageTest.php
@@ -177,7 +177,7 @@ function testTempFileNoCleanup() {
list($temp_old, $temp_new, $perm_old, $perm_new) = $this->createTempFiles();
// Set the max age to 0, meaning no temporary files will be deleted.
- \Drupal::config('system.file')
+ $this->config('system.file')
->set('temporary_maximum_age', 0)
->save();
@@ -196,7 +196,7 @@ function testTempFileCustomCleanup() {
list($temp_old, $temp_new, $perm_old, $perm_new) = $this->createTempFiles();
// Set the max age to older than default.
- \Drupal::config('system.file')
+ $this->config('system.file')
->set('temporary_maximum_age', 21600 + 2)
->save();
diff --git a/core/modules/filter/src/Tests/FilterAPITest.php b/core/modules/filter/src/Tests/FilterAPITest.php
index 2808fc1..d4c47bf 100644
--- a/core/modules/filter/src/Tests/FilterAPITest.php
+++ b/core/modules/filter/src/Tests/FilterAPITest.php
@@ -351,21 +351,21 @@ public function testFilterFormatPreSave() {
$crazy_format->save();
// Use config to directly load the configuration and check that only enabled
// or customized plugins are saved to configuration.
- $filters = \Drupal::config('filter.format.crazy')->get('filters');
+ $filters = $this->config('filter.format.crazy')->get('filters');
$this->assertEqual(array('filter_html_escape', 'filter_html'), array_keys($filters));
// Disable a plugin to ensure that disabled plugins with custom settings are
// stored in configuration.
$crazy_format->setFilterConfig('filter_html_escape', array('status' => FALSE));
$crazy_format->save();
- $filters = \Drupal::config('filter.format.crazy')->get('filters');
+ $filters = $this->config('filter.format.crazy')->get('filters');
$this->assertEqual(array('filter_html_escape', 'filter_html'), array_keys($filters));
// Set the settings as per default to ensure that disable plugins in this
// state are not stored in configuration.
$crazy_format->setFilterConfig('filter_html_escape', array('weight' => -10));
$crazy_format->save();
- $filters = \Drupal::config('filter.format.crazy')->get('filters');
+ $filters = $this->config('filter.format.crazy')->get('filters');
$this->assertEqual(array('filter_html'), array_keys($filters));
}
diff --git a/core/modules/filter/src/Tests/FilterAdminTest.php b/core/modules/filter/src/Tests/FilterAdminTest.php
index 67c4dea..1d06df7 100644
--- a/core/modules/filter/src/Tests/FilterAdminTest.php
+++ b/core/modules/filter/src/Tests/FilterAdminTest.php
@@ -290,7 +290,7 @@ function testFilterAdmin() {
// Use plain text and see if it escapes all tags, whether allowed or not.
// In order to test plain text, we have to enable the hidden variable for
// "show_fallback_format", which displays plain text in the format list.
- \Drupal::config('filter.settings')
+ $this->config('filter.settings')
->set('always_show_fallback_choice', TRUE)
->save();
$edit = array();
@@ -298,7 +298,7 @@ function testFilterAdmin() {
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
$this->drupalGet('node/' . $node->id());
$this->assertText(String::checkPlain($text), 'The "Plain text" text format escapes all HTML tags.');
- \Drupal::config('filter.settings')
+ $this->config('filter.settings')
->set('always_show_fallback_choice', FALSE)
->save();
diff --git a/core/modules/filter/src/Tests/FilterUnitTest.php b/core/modules/filter/src/Tests/FilterUnitTest.php
index 00977ab..8d06de7 100644
--- a/core/modules/filter/src/Tests/FilterUnitTest.php
+++ b/core/modules/filter/src/Tests/FilterUnitTest.php
@@ -506,7 +506,7 @@ function testUrlFilter() {
),
// Absolute URL protocols.
// The list to test is found in the beginning of _filter_url() at
- // $protocols = \Drupal::config('system.filter')->get('protocols')... (approx line 1555).
+ // $protocols = $this->config('system.filter')->get('protocols')... (approx line 1555).
'
https://example.com,
ftp://ftp.example.com,
diff --git a/core/modules/forum/src/Tests/ForumTest.php b/core/modules/forum/src/Tests/ForumTest.php
index c716f5a..dbd72b8 100644
--- a/core/modules/forum/src/Tests/ForumTest.php
+++ b/core/modules/forum/src/Tests/ForumTest.php
@@ -217,7 +217,7 @@ function testForum() {
*/
function testAddOrphanTopic() {
// Must remove forum topics to test creating orphan topics.
- $vid = \Drupal::config('forum.settings')->get('vocabulary');
+ $vid = $this->config('forum.settings')->get('vocabulary');
$tids = \Drupal::entityQuery('taxonomy_term')
->condition('vid', $vid)
->execute();
@@ -322,7 +322,7 @@ private function doAdminTests($user) {
*/
function editForumVocabulary() {
// Backup forum taxonomy.
- $vid = \Drupal::config('forum.settings')->get('vocabulary');
+ $vid = $this->config('forum.settings')->get('vocabulary');
$original_vocabulary = entity_load('taxonomy_vocabulary', $vid);
// Generate a random name and description.
@@ -388,7 +388,7 @@ function createForum($type, $parent = 0) {
);
// Verify forum.
- $term = db_query("SELECT * FROM {taxonomy_term_field_data} t WHERE t.vid = :vid AND t.name = :name AND t.description__value = :desc AND t.default_langcode = 1", array(':vid' => \Drupal::config('forum.settings')->get('vocabulary'), ':name' => $name, ':desc' => $description))->fetchAssoc();
+ $term = db_query("SELECT * FROM {taxonomy_term_field_data} t WHERE t.vid = :vid AND t.name = :name AND t.description__value = :desc AND t.default_langcode = 1", array(':vid' => $this->config('forum.settings')->get('vocabulary'), ':name' => $name, ':desc' => $description))->fetchAssoc();
$this->assertTrue(!empty($term), 'The ' . $type . ' exists in the database');
// Verify forum hierarchy.
diff --git a/core/modules/forum/src/Tests/ForumUninstallTest.php b/core/modules/forum/src/Tests/ForumUninstallTest.php
index 904ac9d..2dacfbf 100644
--- a/core/modules/forum/src/Tests/ForumUninstallTest.php
+++ b/core/modules/forum/src/Tests/ForumUninstallTest.php
@@ -89,7 +89,7 @@ public function testForumUninstallWithField() {
$this->assertText('To uninstall Forum first delete all Forums terms');
// Delete any forum terms.
- $vid = \Drupal::config('forum.settings')->get('vocabulary');
+ $vid = $this->config('forum.settings')->get('vocabulary');
$terms = entity_load_multiple_by_properties('taxonomy_term', ['vid' => $vid]);
foreach ($terms as $term) {
$term->delete();
diff --git a/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php b/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php
index b57ce9f..abe8ffb 100644
--- a/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php
+++ b/core/modules/image/src/Tests/ImageStylesPathAndUrlTest.php
@@ -119,7 +119,7 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash =
// Make the default scheme neither "public" nor "private" to verify the
// functions work for other than the default scheme.
- \Drupal::config('system.file')->set('default_scheme', 'temporary')->save();
+ $this->config('system.file')->set('default_scheme', 'temporary')->save();
// Create the directories for the styles.
$directory = $scheme . '://styles/' . $this->style->id();
@@ -162,11 +162,11 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash =
// rather than a URI. We need to temporarily switch the default scheme to
// match the desired scheme before testing this, then switch it back to the
// "temporary" scheme used throughout this test afterwards.
- \Drupal::config('system.file')->set('default_scheme', $scheme)->save();
+ $this->config('system.file')->set('default_scheme', $scheme)->save();
$relative_path = file_uri_target($original_uri);
$generate_url_from_relative_path = $this->style->buildUrl($relative_path, $clean_url);
$this->assertEqual($generate_url, $generate_url_from_relative_path);
- \Drupal::config('system.file')->set('default_scheme', 'temporary')->save();
+ $this->config('system.file')->set('default_scheme', 'temporary')->save();
// Fetch the URL that generates the file.
$this->drupalGet($generate_url);
@@ -220,7 +220,7 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash =
// Allow insecure image derivatives to be created for the remainder of this
// test.
- \Drupal::config('image.settings')->set('allow_insecure_derivatives', TRUE)->save();
+ $this->config('image.settings')->set('allow_insecure_derivatives', TRUE)->save();
// Create another working copy of the file.
$files = $this->drupalGetTestFiles('image');
@@ -233,7 +233,7 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash =
// Suppress the security token in the URL, then get the URL of a file that
// has not been created and try to create it. Check that the security token
// is not present in the URL but that the image is still accessible.
- \Drupal::config('image.settings')->set('suppress_itok_output', TRUE)->save();
+ $this->config('image.settings')->set('suppress_itok_output', TRUE)->save();
$generated_uri = $this->style->buildUri($original_uri);
$this->assertFalse(file_exists($generated_uri), 'Generated file does not exist.');
$generate_url = $this->style->buildUrl($original_uri, $clean_url);
@@ -247,7 +247,7 @@ function doImageStyleUrlAndPathTests($scheme, $clean_url = TRUE, $extra_slash =
*/
protected function enablePageCache() {
// Turn on page caching and rerun the test.
- $config = \Drupal::config('system.performance');
+ $config = $this->config('system.performance');
$config->set('cache.page.use_internal', 1);
$config->set('cache.page.max_age', 300);
$config->save();
diff --git a/core/modules/language/src/Tests/LanguageConfigSchemaTest.php b/core/modules/language/src/Tests/LanguageConfigSchemaTest.php
index 56dd719..40fa4e8 100644
--- a/core/modules/language/src/Tests/LanguageConfigSchemaTest.php
+++ b/core/modules/language/src/Tests/LanguageConfigSchemaTest.php
@@ -49,7 +49,7 @@ protected function setUp() {
*/
function testValidLanguageConfigSchema() {
// Make sure no language configuration available by default.
- $config_data = \Drupal::config('language.settings')->get();
+ $config_data = $this->config('language.settings')->get();
$this->assertTrue(empty($config_data));
$settings_path = 'admin/config/regional/content-language';
@@ -65,7 +65,7 @@ function testValidLanguageConfigSchema() {
$this->drupalPostForm($settings_path, $edit, t('Save configuration'));
- $config_data = \Drupal::config('language.content_settings.menu_link_content.menu_link_content');
+ $config_data = $this->config('language.content_settings.menu_link_content.menu_link_content');
// Make sure configuration saved correctly.
$this->assertTrue($config_data->get('language_alterable'));
diff --git a/core/modules/language/src/Tests/LanguageConfigurationElementTest.php b/core/modules/language/src/Tests/LanguageConfigurationElementTest.php
index fb50294..c98ef25 100644
--- a/core/modules/language/src/Tests/LanguageConfigurationElementTest.php
+++ b/core/modules/language/src/Tests/LanguageConfigurationElementTest.php
@@ -95,7 +95,7 @@ public function testDefaultLangcode() {
$configurable_language = entity_load('configurable_language', $old_default->getId());
$this->assertTrue($configurable_language->isDefault(), 'The en language entity is flagged as the default language.');
- \Drupal::config('system.site')->set('langcode', 'cc')->save();
+ $this->config('system.site')->set('langcode', 'cc')->save();
ContentLanguageSettings::loadByEntityTypeBundle('entity_test','custom_bundle')
->setLanguageAlterable(TRUE)
->setDefaultLangcode(LanguageInterface::LANGCODE_SITE_DEFAULT)
diff --git a/core/modules/language/src/Tests/LanguageDependencyInjectionTest.php b/core/modules/language/src/Tests/LanguageDependencyInjectionTest.php
index b6fc729..1a7a815 100644
--- a/core/modules/language/src/Tests/LanguageDependencyInjectionTest.php
+++ b/core/modules/language/src/Tests/LanguageDependencyInjectionTest.php
@@ -43,7 +43,7 @@ function testDependencyInjectedNewDefaultLanguage() {
$default_language = ConfigurableLanguage::load(\Drupal::languageManager()->getDefaultLanguage()->getId());
// Change the language default object to different values.
ConfigurableLanguage::createFromLangcode('fr')->save();
- \Drupal::config('system.site')->set('langcode', 'fr')->save();
+ $this->config('system.site')->set('langcode', 'fr')->save();
// The language system creates a Language object which contains the
// same properties as the new default language object.
@@ -60,7 +60,7 @@ function testDependencyInjectedNewDefaultLanguage() {
}
// Re-save the previous default language and the delete should work.
- \Drupal::config('system.site')->set('langcode', $default_language->getId())->save();
+ $this->config('system.site')->set('langcode', $default_language->getId())->save();
entity_delete_multiple('configurable_language', array('fr'));
$result = \Drupal::languageManager()->getCurrentLanguage();
diff --git a/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php b/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php
index fb4a3bb..37611cd 100644
--- a/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php
+++ b/core/modules/language/src/Tests/LanguageUILanguageNegotiationTest.php
@@ -91,7 +91,7 @@ function testUILanguageNegotiation() {
// be some bug.
$default_language = \Drupal::languageManager()->getDefaultLanguage();
ConfigurableLanguage::createFromLangcode($langcode_browser_fallback)->save();
- \Drupal::config('system.site')->set('langcode', $langcode_browser_fallback)->save();
+ $this->config('system.site')->set('langcode', $langcode_browser_fallback)->save();
ConfigurableLanguage::createFromLangcode($langcode)->save();
// We will look for this string in the admin/config screen to see if the
@@ -104,8 +104,8 @@ function testUILanguageNegotiation() {
// Now the t()'ed string is in db so switch the language back to default.
// This will rebuild the container so we need to rebuild the container in
// the test environment.
- \Drupal::config('system.site')->set('langcode', $default_language->getId())->save();
- \Drupal::config('language.negotiation')->set('url.prefixes.en', '')->save();
+ $this->config('system.site')->set('langcode', $default_language->getId())->save();
+ $this->config('language.negotiation')->set('url.prefixes.en', '')->save();
$this->rebuildContainer();
// Translate the string.
@@ -150,7 +150,7 @@ function testUILanguageNegotiation() {
$this->runTest($test);
// An invalid language is selected.
- \Drupal::config('language.negotiation')->set('selected_langcode', NULL)->save();
+ $this->config('language.negotiation')->set('selected_langcode', NULL)->save();
$test = array(
'language_negotiation' => array(LanguageNegotiationSelected::METHOD_ID),
'path' => 'admin/config',
@@ -162,7 +162,7 @@ function testUILanguageNegotiation() {
$this->runTest($test);
// No selected language is available.
- \Drupal::config('language.negotiation')->set('selected_langcode', $langcode_unknown)->save();
+ $this->config('language.negotiation')->set('selected_langcode', $langcode_unknown)->save();
$test = array(
'language_negotiation' => array(LanguageNegotiationSelected::METHOD_ID),
'path' => 'admin/config',
@@ -227,7 +227,7 @@ function testUILanguageNegotiation() {
// Unknown language prefix should return 404.
$definitions = \Drupal::languageManager()->getNegotiator()->getNegotiationMethods();
- \Drupal::config('language.types')
+ $this->config('language.types')
->set('negotiation.' . LanguageInterface::TYPE_INTERFACE . '.enabled', array_flip(array_keys($definitions)))
->save();
$this->drupalGet("$langcode_unknown/admin/config", array(), $http_header_browser_fallback);
@@ -354,7 +354,7 @@ protected function runTest($test) {
$this->container->get('language_negotiator')->saveConfiguration(LanguageInterface::TYPE_INTERFACE, $method_weights);
}
if (!empty($test['language_negotiation_url_part'])) {
- \Drupal::config('language.negotiation')
+ $this->config('language.negotiation')
->set('url.source', $test['language_negotiation_url_part'])
->save();
}
@@ -494,7 +494,7 @@ public function testContentCustomization() {
$this->drupalPostForm('admin/config/regional/language/detection', $edit, t('Save settings'));
// Check if configurability persisted.
- $config = \Drupal::config('language.types');
+ $config = $this->config('language.types');
$this->assertTrue(in_array('language_interface', $config->get('configurable')), 'Interface language is configurable.');
$this->assertTrue(in_array('language_content', $config->get('configurable')), 'Content language is configurable.');
diff --git a/core/modules/language/src/Tests/LanguageUrlRewritingTest.php b/core/modules/language/src/Tests/LanguageUrlRewritingTest.php
index 34d83ae..32a8649 100644
--- a/core/modules/language/src/Tests/LanguageUrlRewritingTest.php
+++ b/core/modules/language/src/Tests/LanguageUrlRewritingTest.php
@@ -114,7 +114,7 @@ function testDomainNameNegotiationPort() {
$this->rebuildContainer();
// Enable domain configuration.
- \Drupal::config('language.negotiation')
+ $this->config('language.negotiation')
->set('url.source', LanguageNegotiationUrl::CONFIG_DOMAIN)
->save();
diff --git a/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php b/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php
index 3d26d37..ed3104b 100644
--- a/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php
+++ b/core/modules/locale/src/Tests/LocaleConfigTranslationTest.php
@@ -34,7 +34,7 @@ protected function setUp() {
// Enable import of translations. By default this is disabled for automated
// tests.
- \Drupal::config('locale.settings')
+ $this->config('locale.settings')
->set('translation.import_enabled', TRUE)
->save();
}
diff --git a/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php b/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php
index 1995214..e0b93fe 100644
--- a/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php
+++ b/core/modules/locale/src/Tests/LocaleImportFunctionalTest.php
@@ -55,7 +55,7 @@ protected function setUp() {
// Enable import of translations. By default this is disabled for automated
// tests.
- \Drupal::config('locale.settings')
+ $this->config('locale.settings')
->set('translation.import_enabled', TRUE)
->save();
}
@@ -68,7 +68,7 @@ public function testStandalonePoFile() {
$this->importPoFile($this->getPoFile(), array(
'langcode' => 'fr',
));
- \Drupal::config('locale.settings');
+ $this->config('locale.settings');
// The import should automatically create the corresponding language.
$this->assertRaw(t('The language %language has been created.', array('%language' => 'French')), 'The language has been automatically created.');
diff --git a/core/modules/locale/src/Tests/LocaleLocaleLookupTest.php b/core/modules/locale/src/Tests/LocaleLocaleLookupTest.php
index 96f5a26..66f35e6 100644
--- a/core/modules/locale/src/Tests/LocaleLocaleLookupTest.php
+++ b/core/modules/locale/src/Tests/LocaleLocaleLookupTest.php
@@ -32,7 +32,7 @@ public function setUp() {
// Change the language default object to different values.
ConfigurableLanguage::createFromLangcode('fr')->save();
- \Drupal::config('system.site')->set('langcode', 'fr')->save();
+ $this->config('system.site')->set('langcode', 'fr')->save();
$this->drupalLogin($this->root_user);
}
diff --git a/core/modules/locale/src/Tests/LocalePathTest.php b/core/modules/locale/src/Tests/LocalePathTest.php
index d1678af..cb0b86b 100644
--- a/core/modules/locale/src/Tests/LocalePathTest.php
+++ b/core/modules/locale/src/Tests/LocalePathTest.php
@@ -31,7 +31,7 @@ protected function setUp() {
parent::setUp();
$this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
- \Drupal::config('system.site')->set('page.front', 'node')->save();
+ $this->config('system.site')->set('page.front', 'node')->save();
}
/**
diff --git a/core/modules/locale/src/Tests/LocaleTranslationUiTest.php b/core/modules/locale/src/Tests/LocaleTranslationUiTest.php
index e9919cd..994eb38 100644
--- a/core/modules/locale/src/Tests/LocaleTranslationUiTest.php
+++ b/core/modules/locale/src/Tests/LocaleTranslationUiTest.php
@@ -205,7 +205,7 @@ public function testStringTranslation() {
public function testJavaScriptTranslation() {
$user = $this->drupalCreateUser(array('translate interface', 'administer languages', 'access administration pages'));
$this->drupalLogin($user);
- $config = \Drupal::config('locale.settings');
+ $config = $this->config('locale.settings');
$langcode = 'xx';
// The English name for the language. This will be translated.
diff --git a/core/modules/locale/src/Tests/LocaleUpdateCronTest.php b/core/modules/locale/src/Tests/LocaleUpdateCronTest.php
index 10f0042..8dbee7d 100644
--- a/core/modules/locale/src/Tests/LocaleUpdateCronTest.php
+++ b/core/modules/locale/src/Tests/LocaleUpdateCronTest.php
@@ -36,7 +36,7 @@ public function testUpdateCron() {
// Setup local and remote translations files.
$this->setTranslationFiles();
- \Drupal::config('locale.settings')->set('translation.default_filename', '%project-%version.%language._po')->save();
+ $this->config('locale.settings')->set('translation.default_filename', '%project-%version.%language._po')->save();
// Update translations using batch to ensure a clean test starting point.
$this->drupalGet('admin/reports/translations/check');
diff --git a/core/modules/locale/src/Tests/LocaleUpdateTest.php b/core/modules/locale/src/Tests/LocaleUpdateTest.php
index fffe03c..ad64fe0 100644
--- a/core/modules/locale/src/Tests/LocaleUpdateTest.php
+++ b/core/modules/locale/src/Tests/LocaleUpdateTest.php
@@ -69,7 +69,7 @@ public function testUpdateCheckStatus() {
$this->drupalGet('admin/reports/translations');
$this->assertText(t('Missing translations for one project'));
- $config = \Drupal::config('locale.settings');
+ $config = $this->config('locale.settings');
// Set a flag to let the locale_test module replace the project data with a
// set of test projects.
\Drupal::state()->set('locale.test_projects_alter', TRUE);
@@ -121,7 +121,7 @@ public function testUpdateCheckStatus() {
* - Import overwrite: all existing translations
*/
public function testUpdateImportSourceRemote() {
- $config = \Drupal::config('locale.settings');
+ $config = $this->config('locale.settings');
// Build the test environment.
$this->setTranslationFiles();
@@ -183,7 +183,7 @@ public function testUpdateImportSourceRemote() {
* - Import overwrite: all existing translations
*/
public function testUpdateImportSourceLocal() {
- $config = \Drupal::config('locale.settings');
+ $config = $this->config('locale.settings');
// Build the test environment.
$this->setTranslationFiles();
@@ -237,7 +237,7 @@ public function testUpdateImportSourceLocal() {
* - Import overwrite: only overwrite non-customized translations
*/
public function testUpdateImportModeNonCustomized() {
- $config = \Drupal::config('locale.settings');
+ $config = $this->config('locale.settings');
// Build the test environment.
$this->setTranslationFiles();
@@ -273,7 +273,7 @@ public function testUpdateImportModeNonCustomized() {
* - Import overwrite: don't overwrite any existing translation
*/
public function testUpdateImportModeNone() {
- $config = \Drupal::config('locale.settings');
+ $config = $this->config('locale.settings');
// Build the test environment.
$this->setTranslationFiles();
diff --git a/core/modules/menu_ui/src/Tests/MenuLanguageTest.php b/core/modules/menu_ui/src/Tests/MenuLanguageTest.php
index 3c920b7..f3bcd15 100644
--- a/core/modules/menu_ui/src/Tests/MenuLanguageTest.php
+++ b/core/modules/menu_ui/src/Tests/MenuLanguageTest.php
@@ -160,7 +160,7 @@ function testMenuLanguageRemovedEnglish() {
// Remove English language. To do that another language has to be set as
// default.
- \Drupal::config('system.site')->set('langcode', 'cs')->save();
+ $this->config('system.site')->set('langcode', 'cs')->save();
entity_delete_multiple('configurable_language', array('en'));
// Save the menu again and check if the language is still the same.
diff --git a/core/modules/menu_ui/src/Tests/MenuTest.php b/core/modules/menu_ui/src/Tests/MenuTest.php
index 098ed0a..41bc2ee 100644
--- a/core/modules/menu_ui/src/Tests/MenuTest.php
+++ b/core/modules/menu_ui/src/Tests/MenuTest.php
@@ -198,7 +198,7 @@ function addCustomMenu() {
$this->assertText($label, 'Menu created');
// Confirm that the custom menu block is available.
- $this->drupalGet('admin/structure/block/list/' . \Drupal::config('system.theme')->get('default'));
+ $this->drupalGet('admin/structure/block/list/' . $this->config('system.theme')->get('default'));
$this->assertText($label);
// Enable the block.
@@ -487,7 +487,7 @@ function testSystemMenuRename() {
$this->drupalPostForm('admin/structure/menu/manage/main', $edit, t('Save'));
// Make sure menu shows up with new name in block addition.
- $default_theme = \Drupal::config('system.theme')->get('default');
+ $default_theme = $this->config('system.theme')->get('default');
$this->drupalget('admin/structure/block/list/' . $default_theme);
$this->assertText($edit['label']);
}
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateActionConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateActionConfigsTest.php
index 707d441..5c7daf4 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateActionConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateActionConfigsTest.php
@@ -45,7 +45,7 @@ protected function setUp() {
* Tests migration of action variables to action.settings.yml.
*/
public function testActionSettings() {
- $config = \Drupal::config('action.settings');
+ $config = $this->config('action.settings');
$this->assertIdentical($config->get('recursion_limit'), 35);
$this->assertConfigSchema(\Drupal::service('config.typed'), 'action.settings', $config->get());
}
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateAggregatorConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateAggregatorConfigsTest.php
index 49492af..331bdaa 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateAggregatorConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateAggregatorConfigsTest.php
@@ -45,7 +45,7 @@ protected function setUp() {
* Tests migration of aggregator variables to aggregator.settings.yml.
*/
public function testAggregatorSettings() {
- $config = \Drupal::config('aggregator.settings');
+ $config = $this->config('aggregator.settings');
$this->assertIdentical($config->get('fetcher'), 'aggregator');
$this->assertIdentical($config->get('parser'), 'aggregator');
$this->assertIdentical($config->get('processors'), array('aggregator'));
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateBlockTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateBlockTest.php
index 48615f2..9198ce5 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateBlockTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateBlockTest.php
@@ -60,7 +60,7 @@ protected function setUp() {
));
// Set Bartik and Seven as the default public and admin theme.
- $config = \Drupal::config('system.theme');
+ $config = $this->config('system.theme');
$config->set('default', 'bartik');
$config->set('admin', 'seven');
$config->save();
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateBookConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateBookConfigsTest.php
index 98e6501..35de27f 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateBookConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateBookConfigsTest.php
@@ -46,7 +46,7 @@ protected function setUp() {
* Tests migration of book variables to book.settings.yml.
*/
public function testBookSettings() {
- $config = \Drupal::config('book.settings');
+ $config = $this->config('book.settings');
$this->assertIdentical($config->get('child_type'), 'book');
$this->assertIdentical($config->get('block.navigation.mode'), 'all pages');
$this->assertIdentical($config->get('allowed_types'), array('book'));
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateContactConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateContactConfigsTest.php
index 59015f0..e3f0e29 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateContactConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateContactConfigsTest.php
@@ -55,7 +55,7 @@ protected function setUp() {
* Tests migration of contact variables to contact.settings.yml.
*/
public function testContactSettings() {
- $config = \Drupal::config('contact.settings');
+ $config = $this->config('contact.settings');
$this->assertIdentical($config->get('user_default_enabled'), true);
$this->assertIdentical($config->get('flood.limit'), 3);
$this->assertIdentical($config->get('default_form'), 'some_other_category');
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateDblogConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateDblogConfigsTest.php
index 0b4c096..ae2cccc 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateDblogConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateDblogConfigsTest.php
@@ -46,7 +46,7 @@ protected function setUp() {
* Tests migration of dblog variables to dblog.settings.yml.
*/
public function testBookSettings() {
- $config = \Drupal::config('dblog.settings');
+ $config = $this->config('dblog.settings');
$this->assertIdentical($config->get('row_limit'), 1000);
$this->assertConfigSchema(\Drupal::service('config.typed'), 'dblog.settings', $config->get());
}
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6Test.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6Test.php
index c79cf1d..92e9ef4 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6Test.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateDrupal6Test.php
@@ -153,7 +153,7 @@ class MigrateDrupal6Test extends MigrateFullDrupalTestBase {
*/
protected function setUp() {
parent::setUp();
- $config = \Drupal::config('system.theme');
+ $config = $this->config('system.theme');
$config->set('default', 'bartik');
$config->set('admin', 'seven');
$config->save();
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateFileConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateFileConfigsTest.php
index 39b29f2..212c924 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateFileConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateFileConfigsTest.php
@@ -46,7 +46,7 @@ protected function setUp() {
* Tests migration of file variables to file.settings.yml.
*/
public function testFileSettings() {
- $config = \Drupal::config('file.settings');
+ $config = $this->config('file.settings');
$this->assertIdentical($config->get('description.type'), 'textfield');
$this->assertIdentical($config->get('description.length'), 128);
$this->assertIdentical($config->get('icon.directory'), 'sites/default/files/icons');
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateForumConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateForumConfigsTest.php
index 6f3c2bc..1a138ec 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateForumConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateForumConfigsTest.php
@@ -50,7 +50,7 @@ protected function setUp() {
* Tests migration of forum variables to forum.settings.yml.
*/
public function testForumSettings() {
- $config = \Drupal::config('forum.settings');
+ $config = $this->config('forum.settings');
$this->assertIdentical($config->get('topics.hot_threshold'), 15);
$this->assertIdentical($config->get('topics.page_limit'), 25);
$this->assertIdentical($config->get('topics.order'), 1);
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateLocaleConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateLocaleConfigsTest.php
index 2a5889f..e00b134 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateLocaleConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateLocaleConfigsTest.php
@@ -45,7 +45,7 @@ protected function setUp() {
* Tests migration of locale variables to locale.settings.yml.
*/
public function testLocaleSettings() {
- $config = \Drupal::config('locale.settings');
+ $config = $this->config('locale.settings');
$this->assertIdentical($config->get('cache_strings'), TRUE);
$this->assertIdentical($config->get('javascript.directory'), 'languages');
$this->assertConfigSchema(\Drupal::service('config.typed'), 'locale.settings', $config->get());
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateMenuConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateMenuConfigsTest.php
index cc8a89d..dcfc0a7 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateMenuConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateMenuConfigsTest.php
@@ -45,7 +45,7 @@ protected function setUp() {
* Tests migration of variables for the Menu UI module.
*/
public function testMenuSettings() {
- $config = \Drupal::config('menu_ui.settings');
+ $config = $this->config('menu_ui.settings');
$this->assertIdentical($config->get('override_parent_selector'), FALSE);
$this->assertConfigSchema(\Drupal::service('config.typed'), 'menu_ui.settings', $config->get());
}
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateNodeConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateNodeConfigsTest.php
index d2675f2..65960dc 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateNodeConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateNodeConfigsTest.php
@@ -46,7 +46,7 @@ protected function setUp() {
* Tests Drupal 6 node settings to Drupal 8 migration.
*/
public function testNodeSettings() {
- $config = \Drupal::config('node.settings');
+ $config = $this->config('node.settings');
$this->assertIdentical($config->get('use_admin_theme'), FALSE);
$this->assertIdentical($config->get('items_per_page'), 3);
$this->assertConfigSchema(\Drupal::service('config.typed'), 'node.settings', $config->get());
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateSearchConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateSearchConfigsTest.php
index b0a955b..f4a0d44 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateSearchConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateSearchConfigsTest.php
@@ -46,7 +46,7 @@ protected function setUp() {
* Tests migration of search variables to search.settings.yml.
*/
public function testSearchSettings() {
- $config = \Drupal::config('search.settings');
+ $config = $this->config('search.settings');
$this->assertIdentical($config->get('index.minimum_word_size'), 3);
$this->assertIdentical($config->get('index.overlap_cjk'), TRUE);
$this->assertIdentical($config->get('index.cron_limit'), 100);
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateSimpletestConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateSimpletestConfigsTest.php
index 9f857b6..d20c288 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateSimpletestConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateSimpletestConfigsTest.php
@@ -46,7 +46,7 @@ protected function setUp() {
* Tests migration of simpletest variables to simpletest.settings.yml.
*/
public function testSimpletestSettings() {
- $config = \Drupal::config('simpletest.settings');
+ $config = $this->config('simpletest.settings');
$this->assertIdentical($config->get('clear_results'), TRUE);
$this->assertIdentical($config->get('httpauth.method'), CURLAUTH_BASIC);
// NULL in the dump means defaults which is empty string. Same as omitting
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateStatisticsConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateStatisticsConfigsTest.php
index 25474a6..ad356cc 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateStatisticsConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateStatisticsConfigsTest.php
@@ -46,7 +46,7 @@ protected function setUp() {
* Tests migration of statistics variables to statistics.settings.yml.
*/
public function testStatisticsSettings() {
- $config = \Drupal::config('statistics.settings');
+ $config = $this->config('statistics.settings');
$this->assertIdentical($config->get('access_log.enabled'), FALSE);
$this->assertIdentical($config->get('access_log.max_lifetime'), 259200);
$this->assertIdentical($config->get('count_content_views'), 0);
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateSyslogConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateSyslogConfigsTest.php
index 8b1bd76..02f7f40 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateSyslogConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateSyslogConfigsTest.php
@@ -45,7 +45,7 @@ protected function setUp() {
* Tests migration of syslog variables to syslog.settings.yml.
*/
public function testSyslogSettings() {
- $config = \Drupal::config('syslog.settings');
+ $config = $this->config('syslog.settings');
$this->assertIdentical($config->get('identity'), 'drupal');
$this->assertIdentical($config->get('facility'), '128');
$this->assertConfigSchema(\Drupal::service('config.typed'), 'syslog.settings', $config->get());
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemCronTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemCronTest.php
index 2bc8216..972883c 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemCronTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemCronTest.php
@@ -36,7 +36,7 @@ protected function setUp() {
* Tests migration of system (cron) variables to system.cron.yml.
*/
public function testSystemCron() {
- $config = \Drupal::config('system.cron');
+ $config = $this->config('system.cron');
$this->assertIdentical($config->get('threshold.requirements_warning'), 172800);
$this->assertIdentical($config->get('threshold.requirements_error'), 1209600);
}
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemFileTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemFileTest.php
index 19be586..0742d55 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemFileTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemFileTest.php
@@ -38,7 +38,7 @@ protected function setUp() {
public function testSystemFile() {
$old_state = \Drupal::configFactory()->getOverrideState();
\Drupal::configFactory()->setOverrideState(FALSE);
- $config = \Drupal::config('system.file');
+ $config = $this->config('system.file');
$this->assertIdentical($config->get('path.temporary'), 'files/temp');
$this->assertIdentical($config->get('allow_insecure_uploads'), TRUE);
\Drupal::configFactory()->setOverrideState($old_state);
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemFilterTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemFilterTest.php
index 6699186..3a41355 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemFilterTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemFilterTest.php
@@ -36,7 +36,7 @@ protected function setUp() {
* Tests migration of system (filter) variables to system.filter.yml.
*/
public function testSystemFilter() {
- $config = \Drupal::config('system.filter');
+ $config = $this->config('system.filter');
$this->assertIdentical($config->get('protocols'), array('http', 'https', 'ftp', 'news', 'nntp', 'tel', 'telnet', 'mailto', 'irc', 'ssh', 'sftp', 'webcal', 'rtsp'));
}
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemImageGdTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemImageGdTest.php
index 2020d5f..2e057c8 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemImageGdTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemImageGdTest.php
@@ -36,7 +36,7 @@ protected function setUp() {
* Tests migration of system (image GD) variables to system.image.gd.yml.
*/
public function testSystemImageGd() {
- $config = \Drupal::config('system.image.gd');
+ $config = $this->config('system.image.gd');
$this->assertIdentical($config->get('jpeg_quality'), 75);
}
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemImageTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemImageTest.php
index f53c732..db322b5 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemImageTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemImageTest.php
@@ -36,7 +36,7 @@ protected function setUp() {
* Tests migration of system (image) variables to system.image.yml.
*/
public function testSystemImage() {
- $config = \Drupal::config('system.image');
+ $config = $this->config('system.image');
$this->assertIdentical($config->get('toolkit'), 'gd');
}
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemLoggingTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemLoggingTest.php
index 25ae285..99bff2b 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemLoggingTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemLoggingTest.php
@@ -38,7 +38,7 @@ protected function setUp() {
* Tests migration of system error_level variables to system.logging.yml.
*/
public function testSystemLogging() {
- $config = \Drupal::config('system.logging');
+ $config = $this->config('system.logging');
$this->assertIdentical($config->get('error_level'), 'some');
$this->assertConfigSchema(\Drupal::service('config.typed'), 'system.logging', $config->get());
}
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemMaintenanceTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemMaintenanceTest.php
index c9477bd..c2d4ec1 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemMaintenanceTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemMaintenanceTest.php
@@ -36,7 +36,7 @@ protected function setUp() {
* Tests migration of system (maintenance) variables to system.maintenance.yml.
*/
public function testSystemMaintenance() {
- $config = \Drupal::config('system.maintenance');
+ $config = $this->config('system.maintenance');
$this->assertIdentical($config->get('message'), 'Drupal is currently under maintenance. We should be back shortly. Thank you for your patience.');
}
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemPerformanceTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemPerformanceTest.php
index ccefac8..056ab69 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemPerformanceTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemPerformanceTest.php
@@ -36,7 +36,7 @@ protected function setUp() {
* Tests migration of system (Performance) variables to system.performance.yml.
*/
public function testSystemPerformance() {
- $config = \Drupal::config('system.performance');
+ $config = $this->config('system.performance');
$this->assertIdentical($config->get('css.preprocess'), FALSE);
$this->assertIdentical($config->get('js.preprocess'), FALSE);
$this->assertIdentical($config->get('cache.page.max_age'), 0);
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemRssTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemRssTest.php
index 750d80a..9fc60aa 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemRssTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemRssTest.php
@@ -36,7 +36,7 @@ protected function setUp() {
* Tests migration of system (rss) variables to system.rss.yml.
*/
public function testSystemRss() {
- $config = \Drupal::config('system.rss');
+ $config = $this->config('system.rss');
$this->assertIdentical($config->get('items.limit'), 10);
$this->assertIdentical($config->get('items.view_mode'), 'title');
}
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemSiteTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemSiteTest.php
index 141f533..ecf46ba 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemSiteTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateSystemSiteTest.php
@@ -36,7 +36,7 @@ protected function setUp() {
* Tests migration of system (site) variables to system.site.yml.
*/
public function testSystemSite() {
- $config = \Drupal::config('system.site');
+ $config = $this->config('system.site');
$this->assertIdentical($config->get('name'), 'site_name');
$this->assertIdentical($config->get('mail'), 'site_mail@example.com');
$this->assertIdentical($config->get('slogan'), 'Migrate rocks');
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateTaxonomyConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateTaxonomyConfigsTest.php
index 5426165..c788699 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateTaxonomyConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateTaxonomyConfigsTest.php
@@ -45,7 +45,7 @@ protected function setUp() {
* Tests migration of taxonomy variables to taxonomy.settings.yml.
*/
public function testTaxonomySettings() {
- $config = \Drupal::config('taxonomy.settings');
+ $config = $this->config('taxonomy.settings');
$this->assertIdentical($config->get('terms_per_page_admin'), 100);
$this->assertIdentical($config->get('override_selector'), FALSE);
$this->assertConfigSchema(\Drupal::service('config.typed'), 'taxonomy.settings', $config->get());
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateTextConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateTextConfigsTest.php
index c2b967e..29da7a8 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateTextConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateTextConfigsTest.php
@@ -45,7 +45,7 @@ protected function setUp() {
* Tests migration of text variables to text.settings.yml.
*/
public function testTextSettings() {
- $config = \Drupal::config('text.settings');
+ $config = $this->config('text.settings');
$this->assertIdentical($config->get('default_summary_length'), 456);
$this->assertConfigSchema(\Drupal::service('config.typed'), 'text.settings', $config->get());
}
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUpdateConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUpdateConfigsTest.php
index 92c6c49..413b113 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUpdateConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateUpdateConfigsTest.php
@@ -45,7 +45,7 @@ protected function setUp() {
* Tests migration of update variables to update.settings.yml.
*/
public function testUpdateSettings() {
- $config = \Drupal::config('update.settings');
+ $config = $this->config('update.settings');
$this->assertIdentical($config->get('fetch.max_attempts'), 2);
$this->assertIdentical($config->get('fetch.url'), 'http://updates.drupal.org/release-history');
$this->assertIdentical($config->get('notification.threshold'), 'all');
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserConfigsTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserConfigsTest.php
index 278d1cb..3e74fde 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserConfigsTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserConfigsTest.php
@@ -46,7 +46,7 @@ protected function setUp() {
* Tests migration of user variables to user.mail.yml.
*/
public function testUserMail() {
- $config = \Drupal::config('user.mail');
+ $config = $this->config('user.mail');
$this->assertIdentical($config->get('status_activated.subject'), 'Account details for !username at !site (approved)');
$this->assertIdentical($config->get('status_activated.body'), "!username,\n\nYour account at !site has been activated.\n\nYou may now log in by clicking on this link or copying and pasting it in your browser:\n\n!login_url\n\nThis is a one-time login, so it can be used only once.\n\nAfter logging in, you will be redirected to !edit_uri so you can change your password.\n\nOnce you have set your own password, you will be able to log in to !login_uri in the future using:\n\nusername: !username\n");
$this->assertIdentical($config->get('password_reset.subject'), 'Replacement login information for !username at !site');
@@ -68,7 +68,7 @@ public function testUserMail() {
* Tests migration of user variables to user.settings.yml.
*/
public function testUserSettings() {
- $config = \Drupal::config('user.settings');
+ $config = $this->config('user.settings');
$this->assertIdentical($config->get('notify.status_blocked'), TRUE);
$this->assertIdentical($config->get('notify.status_activated'), FALSE);
$this->assertIdentical($config->get('signatures'), TRUE);
diff --git a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserTest.php b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserTest.php
index 4a187bc..26ddbd3 100644
--- a/core/modules/migrate_drupal/src/Tests/d6/MigrateUserTest.php
+++ b/core/modules/migrate_drupal/src/Tests/d6/MigrateUserTest.php
@@ -168,7 +168,7 @@ public function testUser() {
// user preferred language is not configured on the site. We just want to
// test if the value was imported correctly.
$this->assertEqual($user->preferred_langcode->value, $source->language);
- $time_zone = $source->expected_timezone ?: \Drupal::config('system.date')->get('timezone.default');
+ $time_zone = $source->expected_timezone ?: $this->config('system.date')->get('timezone.default');
$this->assertEqual($user->getTimeZone(), $time_zone);
$this->assertEqual($user->getInitialEmail(), $source->init);
$this->assertEqual($user->getRoles(), $roles);
diff --git a/core/modules/node/src/Tests/NodeAccessPagerTest.php b/core/modules/node/src/Tests/NodeAccessPagerTest.php
index af4140f..9b5299f 100644
--- a/core/modules/node/src/Tests/NodeAccessPagerTest.php
+++ b/core/modules/node/src/Tests/NodeAccessPagerTest.php
@@ -71,7 +71,7 @@ public function testCommentPager() {
*/
public function testForumPager() {
// Look up the forums vocabulary ID.
- $vid = \Drupal::config('forum.settings')->get('vocabulary');
+ $vid = $this->config('forum.settings')->get('vocabulary');
$this->assertTrue($vid, 'Forum navigation vocabulary ID is set.');
// Look up the general discussion term.
diff --git a/core/modules/node/src/Tests/NodeCreationTest.php b/core/modules/node/src/Tests/NodeCreationTest.php
index d939dab..7ec85eb 100644
--- a/core/modules/node/src/Tests/NodeCreationTest.php
+++ b/core/modules/node/src/Tests/NodeCreationTest.php
@@ -119,7 +119,7 @@ function testFailedPageCreation() {
*/
function testUnpublishedNodeCreation() {
// Set the front page to the test page.
- \Drupal::config('system.site')->set('page.front', 'test-page')->save();
+ $this->config('system.site')->set('page.front', 'test-page')->save();
// Set "Basic page" content type to be unpublished by default.
$fields = \Drupal::entityManager()->getFieldDefinitions('node', 'page');
diff --git a/core/modules/node/src/Tests/Views/NodeLanguageTest.php b/core/modules/node/src/Tests/Views/NodeLanguageTest.php
index edf5ae8..0195b44 100644
--- a/core/modules/node/src/Tests/Views/NodeLanguageTest.php
+++ b/core/modules/node/src/Tests/Views/NodeLanguageTest.php
@@ -182,7 +182,7 @@ public function testLanguages() {
// Override the config for the front page view, so that the language
// filter is set to the site default language instead. This should just
// show the English nodes, no matter what the content language is.
- $config = \Drupal::config('views.view.frontpage');
+ $config = $this->config('views.view.frontpage');
$config->set('display.default.display_options.filters.langcode.value', array(PluginBase::VIEWS_QUERY_LANGUAGE_SITE_DEFAULT => PluginBase::VIEWS_QUERY_LANGUAGE_SITE_DEFAULT));
$config->save();
foreach ($this->node_titles as $langcode => $titles) {
@@ -206,10 +206,10 @@ public function testLanguages() {
// language configuration!
$config->set('display.default.display_options.filters.langcode.value', array('***LANGUAGE_language_interface***' => '***LANGUAGE_language_interface***'));
$config->save();
- $language_config = \Drupal::config('language.types');
+ $language_config = $this->config('language.types');
$language_config->set('negotiation.language_interface.enabled', array('language-selected' => 1));
$language_config->save();
- $language_config = \Drupal::config('language.negotiation');
+ $language_config = $this->config('language.negotiation');
$language_config->set('selected_langcode', 'es');
$language_config->save();
diff --git a/core/modules/rest/src/Tests/RESTTestBase.php b/core/modules/rest/src/Tests/RESTTestBase.php
index 2fa0331..105df19 100644
--- a/core/modules/rest/src/Tests/RESTTestBase.php
+++ b/core/modules/rest/src/Tests/RESTTestBase.php
@@ -222,7 +222,7 @@ protected function entityValues($entity_type) {
*/
protected function enableService($resource_type, $method = 'GET', $format = NULL, $auth = NULL) {
// Enable REST API for this entity type.
- $config = \Drupal::config('rest.settings');
+ $config = $this->config('rest.settings');
$settings = array();
if ($resource_type) {
diff --git a/core/modules/rest/src/Tests/ResourceTest.php b/core/modules/rest/src/Tests/ResourceTest.php
index 1b91551..6814587 100644
--- a/core/modules/rest/src/Tests/ResourceTest.php
+++ b/core/modules/rest/src/Tests/ResourceTest.php
@@ -28,7 +28,7 @@ class ResourceTest extends RESTTestBase {
*/
protected function setUp() {
parent::setUp();
- $this->config = \Drupal::config('rest.settings');
+ $this->config = $this->config('rest.settings');
// Create an entity programmatically.
$this->entity = $this->entityCreate('entity_test');
diff --git a/core/modules/search/src/Tests/SearchMatchTest.php b/core/modules/search/src/Tests/SearchMatchTest.php
index 5243b52..a24ef09 100644
--- a/core/modules/search/src/Tests/SearchMatchTest.php
+++ b/core/modules/search/src/Tests/SearchMatchTest.php
@@ -33,7 +33,7 @@ function testMatching() {
* Set up a small index of items to test against.
*/
function _setup() {
- \Drupal::config('search.settings')->set('index.minimum_word_size', 3)->save();
+ $this->config('search.settings')->set('index.minimum_word_size', 3)->save();
for ($i = 1; $i <= 7; ++$i) {
search_index(SEARCH_TYPE, $i, LanguageInterface::LANGCODE_NOT_SPECIFIED, $this->getText($i));
diff --git a/core/modules/search/src/Tests/SearchMultilingualEntityTest.php b/core/modules/search/src/Tests/SearchMultilingualEntityTest.php
index f08e50e..49196be 100644
--- a/core/modules/search/src/Tests/SearchMultilingualEntityTest.php
+++ b/core/modules/search/src/Tests/SearchMultilingualEntityTest.php
@@ -42,7 +42,7 @@ protected function setUp() {
$this->drupalLogin($user);
// Make sure that auto-cron is disabled.
- \Drupal::config('system.cron')->set('threshold.autorun', 0)->save();
+ $this->config('system.cron')->set('threshold.autorun', 0)->save();
// Set up the search plugin.
$this->plugin = $this->container->get('plugin.manager.search')->createInstance('node_search');
@@ -125,7 +125,7 @@ protected function setUp() {
function testMultilingualSearch() {
// Index only 2 nodes per cron run. We cannot do this setting in the UI,
// because it doesn't go this low.
- \Drupal::config('search.settings')->set('index.cron_limit', 2)->save();
+ $this->config('search.settings')->set('index.cron_limit', 2)->save();
// Get a new search plugin, to make sure it has this setting.
$this->plugin = $this->container->get('plugin.manager.search')->createInstance('node_search');
@@ -141,7 +141,7 @@ function testMultilingualSearch() {
// Now index the rest of the nodes.
// Make sure index throttle is high enough, via the UI.
$this->drupalPostForm('admin/config/search/pages', array('cron_limit' => 20), t('Save configuration'));
- $this->assertEqual(20, \Drupal::config('search.settings')->get('index.cron_limit', 100), 'Config setting was saved correctly');
+ $this->assertEqual(20, $this->config('search.settings')->get('index.cron_limit', 100), 'Config setting was saved correctly');
// Get a new search plugin, to make sure it has this setting.
$this->plugin = $this->container->get('plugin.manager.search')->createInstance('node_search');
diff --git a/core/modules/search/src/Tests/SearchPageTextTest.php b/core/modules/search/src/Tests/SearchPageTextTest.php
index 5cb4865..44572e5 100644
--- a/core/modules/search/src/Tests/SearchPageTextTest.php
+++ b/core/modules/search/src/Tests/SearchPageTextTest.php
@@ -75,7 +75,7 @@ function testSearchText() {
// Test a search input exceeding the limit of AND/OR combinations to test
// the Denial-of-Service protection.
- $limit = \Drupal::config('search.settings')->get('and_or_limit');
+ $limit = $this->config('search.settings')->get('and_or_limit');
$keys = array();
for ($i = 0; $i < $limit + 1; $i++) {
// Use a key of 4 characters to ensure we never generate 'AND' or 'OR'.
diff --git a/core/modules/search/src/Tests/SearchRankingTest.php b/core/modules/search/src/Tests/SearchRankingTest.php
index ec725ce..f2fb125 100644
--- a/core/modules/search/src/Tests/SearchRankingTest.php
+++ b/core/modules/search/src/Tests/SearchRankingTest.php
@@ -95,7 +95,7 @@ public function testRankings() {
$this->drupalPostForm(NULL, $edit, t('Save'));
// Enable counting of statistics.
- \Drupal::config('statistics.settings')->set('count_content_views', 1)->save();
+ $this->config('statistics.settings')->set('count_content_views', 1)->save();
// Simulating content views is kind of difficult in the test. Leave that
// to the Statistics module. So instead go ahead and manually update the
diff --git a/core/modules/search/src/Tests/SearchTokenizerTest.php b/core/modules/search/src/Tests/SearchTokenizerTest.php
index efaf09d..a9ca22b 100644
--- a/core/modules/search/src/Tests/SearchTokenizerTest.php
+++ b/core/modules/search/src/Tests/SearchTokenizerTest.php
@@ -26,7 +26,7 @@ class SearchTokenizerTest extends SearchTestBase {
function testTokenizer() {
// Set the minimum word size to 1 (to split all CJK characters) and make
// sure CJK tokenizing is turned on.
- \Drupal::config('search.settings')
+ $this->config('search.settings')
->set('index.minimum_word_size', 1)
->set('index.overlap_cjk', TRUE)
->save();
@@ -114,7 +114,7 @@ function testTokenizer() {
function testNoTokenizer() {
// Set the minimum word size to 1 (to split all CJK characters) and make
// sure CJK tokenizing is turned on.
- \Drupal::config('search.settings')
+ $this->config('search.settings')
->set('index.minimum_word_size', 1)
->set('index.overlap_cjk', TRUE)
->save();
diff --git a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
index d029073..162da37 100644
--- a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
+++ b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php
@@ -100,7 +100,7 @@ public function testShortcutLinkAdd() {
*/
public function testShortcutQuickLink() {
\Drupal::service('theme_handler')->install(array('seven'));
- \Drupal::config('system.theme')->set('admin', 'seven')->save();
+ $this->config('system.theme')->set('admin', 'seven')->save();
$this->container->get('config.factory')->get('node.settings')->set('use_admin_theme', '1')->save();
$this->container->get('router.builder')->rebuild();
@@ -206,7 +206,7 @@ public function testShortcutLinkDelete() {
public function testNoShortcutLink() {
// Change to a theme that displays shortcuts.
\Drupal::service('theme_handler')->install(array('seven'));
- \Drupal::config('system.theme')
+ $this->config('system.theme')
->set('default', 'seven')
->save();
@@ -237,7 +237,7 @@ public function testNoShortcutLink() {
public function testAccessShortcutsPermission() {
// Change to a theme that displays shortcuts.
\Drupal::service('theme_handler')->install(array('seven'));
- \Drupal::config('system.theme')
+ $this->config('system.theme')
->set('default', 'seven')
->save();
diff --git a/core/modules/simpletest/src/KernelTestBase.php b/core/modules/simpletest/src/KernelTestBase.php
index f26c5d4..6991181 100644
--- a/core/modules/simpletest/src/KernelTestBase.php
+++ b/core/modules/simpletest/src/KernelTestBase.php
@@ -203,7 +203,7 @@ protected function setUp() {
$this->enableModules($modules);
}
// In order to use theme functions default theme config needs to exist.
- \Drupal::config('system.theme')->set('default', 'classy');
+ $this->config('system.theme')->set('default', 'classy');
// Tests based on this class are entitled to use Drupal's File and
// StreamWrapper APIs.
diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php
index d414afc..998f72e 100644
--- a/core/modules/simpletest/src/TestBase.php
+++ b/core/modules/simpletest/src/TestBase.php
@@ -798,7 +798,7 @@ public function run(array $methods = array()) {
}
TestServiceProvider::$currentTest = $this;
- $simpletest_config = \Drupal::config('simpletest.settings');
+ $simpletest_config = $this->config('simpletest.settings');
// Unless preset from run-tests.sh, retrieve the current verbose setting.
if (!isset($this->verbose)) {
@@ -1516,4 +1516,23 @@ public function copyConfig(StorageInterface $source_storage, StorageInterface $t
$target_storage->write($name, $source_storage->read($name));
}
}
+
+ /**
+ * Configuration accessor for tests. Returns non-overriden configuration.
+ *
+ * @param $name
+ * Configuration name.
+ *
+ * @return \Drupal\Core\Config\Config
+ * The configuration object with original configuration data.
+ */
+ public function config($name) {
+ $config_factory = \Drupal::configFactory();
+ $old_state = $config_factory->getOverrideState();
+ $config_factory->setOverrideState(FALSE);
+ $config = $config_factory->get($name);
+ $config_factory->setOverrideState($old_state);
+ return $config;
+ }
+
}
diff --git a/core/modules/simpletest/src/Tests/KernelTestBaseTest.php b/core/modules/simpletest/src/Tests/KernelTestBaseTest.php
index 62612dd..1fe5497 100644
--- a/core/modules/simpletest/src/Tests/KernelTestBaseTest.php
+++ b/core/modules/simpletest/src/Tests/KernelTestBaseTest.php
@@ -207,7 +207,7 @@ function testInstallConfig() {
$this->enableModules(array('user'));
$this->installConfig(array('user'));
$this->assertTrue($this->container->get('config.storage')->exists('user.settings'));
- $this->assertTrue(\Drupal::config('user.settings')->get('register'));
+ $this->assertTrue($this->config('user.settings')->get('register'));
}
/**
diff --git a/core/modules/simpletest/src/Tests/SimpleTestBrowserTest.php b/core/modules/simpletest/src/Tests/SimpleTestBrowserTest.php
index 33fedd8..a5b9703 100644
--- a/core/modules/simpletest/src/Tests/SimpleTestBrowserTest.php
+++ b/core/modules/simpletest/src/Tests/SimpleTestBrowserTest.php
@@ -37,7 +37,7 @@ public function testInternalBrowser() {
$this->drupalGet('test-page');
$this->assertTrue($this->drupalGetHeader('Date'), 'An HTTP header was received.');
$this->assertTitle(t('Test page | @site-name', array(
- '@site-name' => \Drupal::config('system.site')->get('name'),
+ '@site-name' => $this->config('system.site')->get('name'),
)));
$this->assertNoTitle('Foo');
diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php
index 1f62ef4..4109d83 100644
--- a/core/modules/simpletest/src/WebTestBase.php
+++ b/core/modules/simpletest/src/WebTestBase.php
@@ -374,7 +374,7 @@ protected function drupalPlaceBlock($plugin_id, array $settings = array()) {
'plugin' => $plugin_id,
'region' => 'sidebar_first',
'id' => strtolower($this->randomMachineName(8)),
- 'theme' => \Drupal::config('system.theme')->get('default'),
+ 'theme' => $this->config('system.theme')->get('default'),
'label' => $this->randomMachineName(8),
'visibility' => array(),
'weight' => 0,
diff --git a/core/modules/statistics/src/Tests/StatisticsAdminTest.php b/core/modules/statistics/src/Tests/StatisticsAdminTest.php
index 63af122..d2561a9 100644
--- a/core/modules/statistics/src/Tests/StatisticsAdminTest.php
+++ b/core/modules/statistics/src/Tests/StatisticsAdminTest.php
@@ -62,13 +62,13 @@ protected function setUp() {
* Verifies that the statistics settings page works.
*/
function testStatisticsSettings() {
- $config = \Drupal::config('statistics.settings');
+ $config = $this->config('statistics.settings');
$this->assertFalse($config->get('count_content_views'), 'Count content view log is disabled by default.');
// Enable counter on content view.
$edit['statistics_count_content_views'] = 1;
$this->drupalPostForm('admin/config/system/statistics', $edit, t('Save configuration'));
- $config = \Drupal::config('statistics.settings');
+ $config = $this->config('statistics.settings');
$this->assertTrue($config->get('count_content_views'), 'Count content view log is enabled.');
// Hit the node.
@@ -95,7 +95,7 @@ function testStatisticsSettings() {
* Tests that when a node is deleted, the node counter is deleted too.
*/
function testDeleteNode() {
- \Drupal::config('statistics.settings')->set('count_content_views', 1)->save();
+ $this->config('statistics.settings')->set('count_content_views', 1)->save();
$this->drupalGet('node/' . $this->testNode->id());
// Manually calling statistics.php, simulating ajax behavior.
@@ -126,7 +126,7 @@ function testDeleteNode() {
* Tests that cron clears day counts and expired access logs.
*/
function testExpiredLogs() {
- \Drupal::config('statistics.settings')
+ $this->config('statistics.settings')
->set('count_content_views', 1)
->save();
\Drupal::state()->set('statistics.day_timestamp', 8640000);
diff --git a/core/modules/statistics/src/Tests/StatisticsLoggingTest.php b/core/modules/statistics/src/Tests/StatisticsLoggingTest.php
index ff1d8ae..cc792cd 100644
--- a/core/modules/statistics/src/Tests/StatisticsLoggingTest.php
+++ b/core/modules/statistics/src/Tests/StatisticsLoggingTest.php
@@ -54,7 +54,7 @@ protected function setUp() {
$this->node = $this->drupalCreateNode(array('title' => $this->randomMachineName(255), 'uid' => $this->authUser->id()));
// Enable access logging.
- \Drupal::config('statistics.settings')
+ $this->config('statistics.settings')
->set('count_content_views', 1)
->save();
diff --git a/core/modules/statistics/src/Tests/StatisticsTestBase.php b/core/modules/statistics/src/Tests/StatisticsTestBase.php
index c6604d4..077267e 100644
--- a/core/modules/statistics/src/Tests/StatisticsTestBase.php
+++ b/core/modules/statistics/src/Tests/StatisticsTestBase.php
@@ -48,7 +48,7 @@ protected function setUp() {
$this->drupalLogin($this->blockingUser);
// Enable logging.
- \Drupal::config('statistics.settings')
+ $this->config('statistics.settings')
->set('count_content_views', 1)
->save();
}
diff --git a/core/modules/system/src/Tests/Ajax/AjaxFormPageCacheTest.php b/core/modules/system/src/Tests/Ajax/AjaxFormPageCacheTest.php
index 3d9ffa2..9da0935 100644
--- a/core/modules/system/src/Tests/Ajax/AjaxFormPageCacheTest.php
+++ b/core/modules/system/src/Tests/Ajax/AjaxFormPageCacheTest.php
@@ -20,7 +20,7 @@ class AjaxFormPageCacheTest extends AjaxTestBase {
public function setUp() {
parent::setUp();
- $config = \Drupal::config('system.performance');
+ $config = $this->config('system.performance');
$config->set('cache.page.use_internal', 1);
$config->set('cache.page.max_age', 300);
$config->save();
diff --git a/core/modules/system/src/Tests/Ajax/FrameworkTest.php b/core/modules/system/src/Tests/Ajax/FrameworkTest.php
index cded8cb..5b4d2a3 100644
--- a/core/modules/system/src/Tests/Ajax/FrameworkTest.php
+++ b/core/modules/system/src/Tests/Ajax/FrameworkTest.php
@@ -193,7 +193,7 @@ public function testLazyLoadOverriddenCSS() {
// The test theme overrides system.module.css without an implementation,
// thereby removing it.
\Drupal::service('theme_handler')->install(array('test_theme'));
- \Drupal::config('system.theme')
+ $this->config('system.theme')
->set('default', 'test_theme')
->save();
diff --git a/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php b/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php
index 9a11d1b..a016161 100644
--- a/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php
+++ b/core/modules/system/src/Tests/Bootstrap/PageCacheTest.php
@@ -31,7 +31,7 @@ class PageCacheTest extends WebTestBase {
protected function setUp() {
parent::setUp();
- \Drupal::config('system.site')
+ $this->config('system.site')
->set('name', 'Drupal')
->set('page.front', 'test-page')
->save();
@@ -44,7 +44,7 @@ protected function setUp() {
* persisted.
*/
function testPageCacheTags() {
- $config = \Drupal::config('system.performance');
+ $config = $this->config('system.performance');
$config->set('cache.page.use_internal', 1);
$config->set('cache.page.max_age', 300);
$config->save();
@@ -79,7 +79,7 @@ function testPageCacheTags() {
* Tests support for different cache items with different Accept headers.
*/
function testAcceptHeaderRequests() {
- $config = \Drupal::config('system.performance');
+ $config = $this->config('system.performance');
$config->set('cache.page.use_internal', 1);
$config->set('cache.page.max_age', 300);
$config->save();
@@ -106,7 +106,7 @@ function testAcceptHeaderRequests() {
* Tests support of requests with If-Modified-Since and If-None-Match headers.
*/
function testConditionalRequests() {
- $config = \Drupal::config('system.performance');
+ $config = $this->config('system.performance');
$config->set('cache.page.use_internal', 1);
$config->set('cache.page.max_age', 300);
$config->save();
@@ -151,7 +151,7 @@ function testConditionalRequests() {
* Tests cache headers.
*/
function testPageCache() {
- $config = \Drupal::config('system.performance');
+ $config = $this->config('system.performance');
$config->set('cache.page.use_internal', 1);
$config->set('cache.page.max_age', 300);
$config->set('response.gzip', 1);
@@ -197,7 +197,7 @@ function testPageCache() {
* Tests the omit_vary_cookie setting.
*/
public function testPageCacheWithoutVaryCookie() {
- $config = \Drupal::config('system.performance');
+ $config = $this->config('system.performance');
$config->set('cache.page.use_internal', 1);
$config->set('cache.page.max_age', 300);
$config->save();
@@ -227,7 +227,7 @@ public function testPageCacheWithoutVaryCookie() {
* mod_deflate Apache module.
*/
function testPageCompression() {
- $config = \Drupal::config('system.performance');
+ $config = $this->config('system.performance');
$config->set('cache.page.use_internal', 1);
$config->set('cache.page.max_age', 300);
$config->set('response.gzip', 1);
@@ -250,7 +250,7 @@ function testPageCompression() {
$this->drupalGet('');
$this->assertEqual($this->drupalGetHeader('X-Drupal-Cache'), 'HIT', 'Page was cached.');
$this->assertFalse($this->drupalGetHeader('Content-Encoding'), 'A Content-Encoding header was not sent.');
- $this->assertTitle(t('Test page | @site-name', array('@site-name' => \Drupal::config('system.site')->get('name'))), 'Site title matches.');
+ $this->assertTitle(t('Test page | @site-name', array('@site-name' => $this->config('system.site')->get('name'))), 'Site title matches.');
$this->assertRaw('