diff --git a/core/modules/aggregator/src/Tests/FeedParserTest.php b/core/modules/aggregator/src/Tests/FeedParserTest.php index a6d44c7..ab6aaaf 100644 --- a/core/modules/aggregator/src/Tests/FeedParserTest.php +++ b/core/modules/aggregator/src/Tests/FeedParserTest.php @@ -20,7 +20,7 @@ protected function setUp() { // Do not delete old aggregator items during these tests, since our sample // feeds have hardcoded dates in them (which may be expired when this test // is run). - $this->container->get('config.factory')->get('aggregator.settings')->set('items.expire', AGGREGATOR_CLEAR_NEVER)->save(); + $this->config('aggregator.settings')->set('items.expire', AGGREGATOR_CLEAR_NEVER)->save(); // Reset any reader cache between tests. Reader::reset(); // Set our bridge extension manager to Zend Feed. diff --git a/core/modules/block/src/Tests/BlockTest.php b/core/modules/block/src/Tests/BlockTest.php index 6140404..9c30e10 100644 --- a/core/modules/block/src/Tests/BlockTest.php +++ b/core/modules/block/src/Tests/BlockTest.php @@ -190,7 +190,7 @@ function testBlock() { public function testBlockThemeSelector() { // Install all themes. \Drupal::service('theme_handler')->install(array('bartik', 'seven')); - $theme_settings = $this->container->get('config.factory')->get('system.theme'); + $theme_settings = $this->config('system.theme'); foreach (array('bartik', 'classy', 'seven') as $theme) { $this->drupalGet('admin/structure/block/list/' . $theme); $this->assertTitle(t('Block layout') . ' | Drupal'); diff --git a/core/modules/block_content/src/Tests/BlockContentTypeTest.php b/core/modules/block_content/src/Tests/BlockContentTypeTest.php index 632c12a..60f1210 100644 --- a/core/modules/block_content/src/Tests/BlockContentTypeTest.php +++ b/core/modules/block_content/src/Tests/BlockContentTypeTest.php @@ -149,7 +149,7 @@ public function testsBlockContentAddTypes() { // Install all themes. \Drupal::service('theme_handler')->install(array('bartik', 'seven')); $themes = array('bartik', 'seven', 'classy'); - $theme_settings = $this->container->get('config.factory')->get('system.theme'); + $theme_settings = $this->config('system.theme'); foreach ($themes as $default_theme) { // Change the default theme. $theme_settings->set('default', $default_theme)->save(); diff --git a/core/modules/ckeditor/src/Tests/CKEditorTest.php b/core/modules/ckeditor/src/Tests/CKEditorTest.php index f5a637b..e81caf2 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']); - $this->config('system.theme')->set('default', 'bartik'); + $this->config('system.theme')->set('default', 'bartik')->save(); $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/config/src/Tests/ConfigCRUDTest.php b/core/modules/config/src/Tests/ConfigCRUDTest.php index 1c1ac65..25391fe 100644 --- a/core/modules/config/src/Tests/ConfigCRUDTest.php +++ b/core/modules/config/src/Tests/ConfigCRUDTest.php @@ -44,6 +44,7 @@ class ConfigCRUDTest extends KernelTestBase { */ function testCRUD() { $storage = $this->container->get('config.storage'); + $config_factory = $this->container->get('config.factory'); $name = 'config_test.crud'; $config = $this->config($name); @@ -73,9 +74,9 @@ function testCRUD() { $this->assertIdentical($config->isNew(), FALSE); // Pollute the config factory static cache. - $this->container->get('config.factory')->setOverrideState(FALSE); - \Drupal::config($name); - $this->container->get('config.factory')->setOverrideState(TRUE); + $config_factory->setOverrideState(FALSE); + $config_factory->get($name); + $config_factory->setOverrideState(TRUE); // Delete the configuration object. $config->delete(); @@ -86,9 +87,9 @@ function testCRUD() { // Verify that all copies of the configuration has been removed from the // static cache. - $this->container->get('config.factory')->setOverrideState(FALSE); - $this->assertIdentical(\Drupal::config($name)->isNew(), TRUE); - $this->container->get('config.factory')->setOverrideState(TRUE); + $config_factory->setOverrideState(FALSE); + $this->assertIdentical($config_factory->get($name)->isNew(), TRUE); + $config_factory->setOverrideState(TRUE); // Verify the active configuration contains no value. $actual_data = $storage->read($name); @@ -128,25 +129,24 @@ function testCRUD() { // Test renaming when config.factory does not have the object in its static // cache. - $config_factory = $this->container->get('config.factory'); $name = 'config_test.crud_rename'; // Turn off overrides and pollute the non-overrides static cache. $config_factory->setOverrideState(FALSE); - \Drupal::config($name); + $config_factory->get($name); // Turn on overrides and pollute the overrides static cache. $config_factory->setOverrideState(TRUE); - $config = \Drupal::config($name); + $config = $config_factory->get($name); // Rename and ensure that happened properly. $new_name = 'config_test.crud_rename_no_cache'; $config_factory->rename($name, $new_name); - $renamed_config = \Drupal::config($new_name); + $renamed_config = $config_factory->get($new_name); $this->assertIdentical($renamed_config->get(), $config->get()); $this->assertIdentical($renamed_config->isNew(), FALSE); // Ensure the overrides static cache has been cleared. - $this->assertIdentical(\Drupal::config($name)->isNew(), TRUE); + $this->assertIdentical($config_factory->get($name)->isNew(), TRUE); // Ensure the non-overrides static cache has been cleared. $config_factory->setOverrideState(FALSE); - $this->assertIdentical(\Drupal::config($name)->isNew(), TRUE); + $this->assertIdentical($config_factory->get($name)->isNew(), TRUE); $config_factory->setOverrideState(TRUE); // Merge data into the configuration object. diff --git a/core/modules/config/src/Tests/ConfigImportAllTest.php b/core/modules/config/src/Tests/ConfigImportAllTest.php index de8e607..e1c2ed1 100644 --- a/core/modules/config/src/Tests/ConfigImportAllTest.php +++ b/core/modules/config/src/Tests/ConfigImportAllTest.php @@ -140,11 +140,10 @@ public function testInstallUninstall() { // conformance. Ensures all imported default configuration is valid when // all modules are enabled. $names = $this->container->get('config.storage')->listAll(); - $factory = $this->container->get('config.factory'); /** @var \Drupal\Core\Config\TypedConfigManagerInterface $typed_config */ $typed_config = $this->container->get('config.typed'); foreach ($names as $name) { - $config = $factory->get($name); + $config = $this->config($name); $this->assertConfigSchema($typed_config, $name, $config->get()); } } diff --git a/core/modules/config/src/Tests/ConfigOtherModuleTest.php b/core/modules/config/src/Tests/ConfigOtherModuleTest.php index 72a332e..5737d78 100644 --- a/core/modules/config/src/Tests/ConfigOtherModuleTest.php +++ b/core/modules/config/src/Tests/ConfigOtherModuleTest.php @@ -25,7 +25,7 @@ public function testInstallOtherModuleFirst() { // Check that the config entity doesn't exist before the config_test module // is enabled. We cannot use the entity system because the config_test // entity type does not exist. - $config = $this->container->get('config.factory')->get('config_test.dynamic.other_module_test'); + $config = $this->config('config_test.dynamic.other_module_test'); $this->assertTrue($config->isNew(), 'Default configuration for other modules is not installed if that module is not enabled.'); // Install the module that provides the entity type. This installs the @@ -36,7 +36,7 @@ public function testInstallOtherModuleFirst() { // Uninstall the module that provides the entity type. This will remove the // default configuration. $this->uninstallModule('config_test'); - $config = $this->container->get('config.factory')->get('config_test.dynamic.other_module_test'); + $config = $this->config('config_test.dynamic.other_module_test'); $this->assertTrue($config->isNew(), 'Default configuration for other modules is removed when the config entity provider is disabled.'); // Install the module that provides the entity type again. This installs the diff --git a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php index 35bfabe..3d0741b 100644 --- a/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php +++ b/core/modules/config_translation/src/Tests/ConfigTranslationUiTest.php @@ -510,9 +510,7 @@ public function testSourceAndTargetLanguage() { $this->assertResponse(403); // Set default language of site information to not-specified language (und). - $this->container - ->get('config.factory') - ->get('system.site') + $this->config('system.site') ->set('langcode', LanguageInterface::LANGCODE_NOT_SPECIFIED) ->save(); diff --git a/core/modules/content_translation/src/Tests/Views/ContentTranslationViewsUITest.php b/core/modules/content_translation/src/Tests/Views/ContentTranslationViewsUITest.php index dc2328b..2ae4936 100644 --- a/core/modules/content_translation/src/Tests/Views/ContentTranslationViewsUITest.php +++ b/core/modules/content_translation/src/Tests/Views/ContentTranslationViewsUITest.php @@ -35,7 +35,7 @@ class ContentTranslationViewsUITest extends UITestBase { */ public function testViewsUI() { $this->drupalGet('admin/structure/views/view/test_view/edit'); - $this->assertTitle(t('@label (@table) | @site-name', array('@label' => 'Test view', '@table' => 'Views test data', '@site-name' => $this->container->get('config.factory')->get('system.site')->get('name')))); + $this->assertTitle(t('@label (@table) | @site-name', array('@label' => 'Test view', '@table' => 'Views test data', '@site-name' => $this->config('system.site')->get('name')))); } } diff --git a/core/modules/datetime/src/Tests/DateTimeFieldTest.php b/core/modules/datetime/src/Tests/DateTimeFieldTest.php index aa5239e..35811bc 100644 --- a/core/modules/datetime/src/Tests/DateTimeFieldTest.php +++ b/core/modules/datetime/src/Tests/DateTimeFieldTest.php @@ -320,7 +320,7 @@ function testDefaultValue() { $this->assertFieldByName('default_value_input[default_date]', '', 'The relative default value is empty in instance settings page'); // Check if default_date has been stored successfully. - $config_entity = $this->container->get('config.factory')->get('field.field.node.date_content.' . $field_name)->get(); + $config_entity = $this->config('field.field.node.date_content.' . $field_name)->get(); $this->assertEqual($config_entity['default_value'][0], array('default_date_type' => 'now', 'default_date' => 'now'), 'Default value has been stored successfully'); // Clear field cache in order to avoid stale cache values. @@ -353,7 +353,7 @@ function testDefaultValue() { $this->assertFieldByName('default_value_input[default_date]', '+90 days', 'The relative default value is displayed in instance settings page'); // Check if default_date has been stored successfully. - $config_entity = $this->container->get('config.factory')->get('field.field.node.date_content.' . $field_name)->get(); + $config_entity = $this->config('field.field.node.date_content.' . $field_name)->get(); $this->assertEqual($config_entity['default_value'][0], array('default_date_type' => 'relative', 'default_date' => '+90 days'), 'Default value has been stored successfully'); // Clear field cache in order to avoid stale cache values. @@ -376,7 +376,7 @@ function testDefaultValue() { $this->assertFieldByName('default_value_input[default_date]', '', 'The relative default value is empty in instance settings page'); // Check if default_date has been stored successfully. - $config_entity = $this->container->get('config.factory')->get('field.field.node.date_content.' . $field_name)->get(); + $config_entity = $this->config('field.field.node.date_content.' . $field_name)->get(); $this->assertTrue(empty($config_entity['default_value']), 'Empty default value has been stored successfully'); // Clear field cache in order to avoid stale cache values. diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php index 2a5d1b6..38bc069 100644 --- a/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php +++ b/core/modules/entity_reference/src/Tests/EntityReferenceFieldDefaultValueTest.php @@ -84,7 +84,7 @@ function testEntityReferenceDefaultValue() { $this->assertRaw('name="default_value_input[' . $field_name . '][0][target_id]" value="' . $referenced_node->getTitle() .' (' .$referenced_node->id() . ')', 'The default value is selected in instance settings page'); // Check if the ID has been converted to UUID in config entity. - $config_entity = $this->container->get('config.factory')->get('field.field.node.reference_content.' . $field_name)->get(); + $config_entity = $this->config('field.field.node.reference_content.' . $field_name)->get(); $this->assertTrue(isset($config_entity['default_value'][0]['target_uuid']), 'Default value contains target_uuid property'); $this->assertEqual($config_entity['default_value'][0]['target_uuid'], $referenced_node->uuid(), 'Content uuid and config entity uuid are the same'); // Ensure the configuration has the expected dependency on the entity that diff --git a/core/modules/file/src/Tests/DeleteTest.php b/core/modules/file/src/Tests/DeleteTest.php index f39239f..5f0acc8 100644 --- a/core/modules/file/src/Tests/DeleteTest.php +++ b/core/modules/file/src/Tests/DeleteTest.php @@ -60,7 +60,7 @@ function testInUse() { // configuration value. db_update('file_managed') ->fields(array( - 'changed' => REQUEST_TIME - ($this->container->get('config.factory')->get('system.file')->get('temporary_maximum_age') + 1), + 'changed' => REQUEST_TIME - ($this->config('system.file')->get('temporary_maximum_age') + 1), )) ->condition('fid', $file->id()) ->execute(); diff --git a/core/modules/file/src/Tests/FileFieldRevisionTest.php b/core/modules/file/src/Tests/FileFieldRevisionTest.php index bf607ee..3c26f59 100644 --- a/core/modules/file/src/Tests/FileFieldRevisionTest.php +++ b/core/modules/file/src/Tests/FileFieldRevisionTest.php @@ -117,7 +117,7 @@ function testRevisions() { // configuration value. db_update('file_managed') ->fields(array( - 'changed' => REQUEST_TIME - ($this->container->get('config.factory')->get('system.file')->get('temporary_maximum_age') + 1), + 'changed' => REQUEST_TIME - ($this->config('system.file')->get('temporary_maximum_age') + 1), )) ->condition('fid', $node_file_r3->id()) ->execute(); @@ -133,7 +133,7 @@ function testRevisions() { // configuration value. db_update('file_managed') ->fields(array( - 'changed' => REQUEST_TIME - ($this->container->get('config.factory')->get('system.file')->get('temporary_maximum_age') + 1), + 'changed' => REQUEST_TIME - ($this->config('system.file')->get('temporary_maximum_age') + 1), )) ->condition('fid', $node_file_r1->id()) ->execute(); diff --git a/core/modules/file/src/Tests/UsageTest.php b/core/modules/file/src/Tests/UsageTest.php index ba5b3b3..da96c47 100644 --- a/core/modules/file/src/Tests/UsageTest.php +++ b/core/modules/file/src/Tests/UsageTest.php @@ -128,7 +128,7 @@ function createTempFiles() { db_update('file_managed') ->fields(array( 'status' => 0, - 'changed' => REQUEST_TIME - $this->container->get('config.factory')->get('system.file')->get('temporary_maximum_age') - 1, + 'changed' => REQUEST_TIME - $this->config('system.file')->get('temporary_maximum_age') - 1, )) ->condition('fid', $temp_old->id()) ->execute(); @@ -145,7 +145,7 @@ function createTempFiles() { // Permanent file that is old. $perm_old = file_save_data(''); db_update('file_managed') - ->fields(array('changed' => REQUEST_TIME - $this->container->get('config.factory')->get('system.file')->get('temporary_maximum_age') - 1)) + ->fields(array('changed' => REQUEST_TIME - $this->config('system.file')->get('temporary_maximum_age') - 1)) ->condition('fid', $temp_old->id()) ->execute(); $this->assertTrue(file_exists($perm_old->getFileUri()), 'Old permanent file was created correctly.'); diff --git a/core/modules/language/src/Tests/LanguageConfigurationTest.php b/core/modules/language/src/Tests/LanguageConfigurationTest.php index 32f70e6..27abc6b 100644 --- a/core/modules/language/src/Tests/LanguageConfigurationTest.php +++ b/core/modules/language/src/Tests/LanguageConfigurationTest.php @@ -45,7 +45,7 @@ function testLanguageConfiguration() { $this->assertText('French'); $this->assertUrl(\Drupal::url('language.admin_overview', [], ['absolute' => TRUE]), [], 'Correct page redirection.'); // Langcode for Languages is always 'en'. - $language = $this->container->get('config.factory')->get('language.entity.fr')->get(); + $language = $this->config('language.entity.fr')->get(); $this->assertEqual($language['langcode'], 'en'); // Check if the Default English language has no path prefix. @@ -107,7 +107,7 @@ function testLanguageConfiguration() { 'predefined_langcode' => 'de', ); $this->drupalPostForm('admin/config/regional/language/add', $edit, 'Add language'); - $language = $this->container->get('config.factory')->get('language.entity.de')->get(); + $language = $this->config('language.entity.de')->get(); $this->assertEqual($language['langcode'], 'en'); } diff --git a/core/modules/language/src/Tests/LanguageNegotiationInfoTest.php b/core/modules/language/src/Tests/LanguageNegotiationInfoTest.php index 60fc384..d96e310 100644 --- a/core/modules/language/src/Tests/LanguageNegotiationInfoTest.php +++ b/core/modules/language/src/Tests/LanguageNegotiationInfoTest.php @@ -106,7 +106,7 @@ function testInfoAlterations() { 'language_test.language_negotiation_info_alter' => TRUE, )); - $negotiation = $this->container->get('config.factory')->get('language.types')->get('negotiation.' . $type . '.enabled'); + $negotiation = $this->config('language.types')->get('negotiation.' . $type . '.enabled'); $this->assertFalse(isset($negotiation[$interface_method_id]), 'Interface language negotiation method removed from the stored settings.'); $this->drupalGet('admin/config/regional/language/detection'); @@ -149,7 +149,7 @@ function testInfoAlterations() { // Check that unavailable language negotiation methods are not present in // the negotiation settings. - $negotiation = $this->container->get('config.factory')->get('language.types')->get('negotiation.' . $type . '.enabled'); + $negotiation = $this->config('language.types')->get('negotiation.' . $type . '.enabled'); $this->assertFalse(isset($negotiation[$test_method_id]), 'The disabled test language negotiation method is not part of the content language negotiation settings.'); // Check that configuration page presents the correct options and settings. @@ -164,7 +164,7 @@ protected function checkFixedLanguageTypes() { $configurable = $this->languageManager()->getLanguageTypes(); foreach ($this->languageManager()->getDefinedLanguageTypesInfo() as $type => $info) { if (!in_array($type, $configurable) && isset($info['fixed'])) { - $negotiation = $this->container->get('config.factory')->get('language.types')->get('negotiation.' . $type . '.enabled'); + $negotiation = $this->config('language.types')->get('negotiation.' . $type . '.enabled'); $equal = count($info['fixed']) == count($negotiation); while ($equal && list($id) = each($negotiation)) { list(, $info_id) = each($info['fixed']); diff --git a/core/modules/node/src/Tests/NodeAccessTest.php b/core/modules/node/src/Tests/NodeAccessTest.php index 0e4978b..b96dfa8 100644 --- a/core/modules/node/src/Tests/NodeAccessTest.php +++ b/core/modules/node/src/Tests/NodeAccessTest.php @@ -19,7 +19,7 @@ class NodeAccessTest extends NodeTestBase { protected function setUp() { parent::setUp(); // Clear permissions for authenticated users. - $this->container->get('config.factory')->get('user.role.' . DRUPAL_AUTHENTICATED_RID)->set('permissions', array())->save(); + $this->config('user.role.' . DRUPAL_AUTHENTICATED_RID)->set('permissions', array())->save(); } /** diff --git a/core/modules/node/src/Tests/Views/FrontPageTest.php b/core/modules/node/src/Tests/Views/FrontPageTest.php index ac93dd3..34ff389 100644 --- a/core/modules/node/src/Tests/Views/FrontPageTest.php +++ b/core/modules/node/src/Tests/Views/FrontPageTest.php @@ -43,8 +43,7 @@ protected function setUp() { */ public function testFrontPage() { $site_name = $this->randomMachineName(); - $this->container->get('config.factory') - ->get('system.site') + $this->config('system.site') ->set('name', $site_name) ->save(); diff --git a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php index 162da37..d9cb0c7 100644 --- a/core/modules/shortcut/src/Tests/ShortcutLinksTest.php +++ b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php @@ -101,7 +101,7 @@ public function testShortcutLinkAdd() { public function testShortcutQuickLink() { \Drupal::service('theme_handler')->install(array('seven')); $this->config('system.theme')->set('admin', 'seven')->save(); - $this->container->get('config.factory')->get('node.settings')->set('use_admin_theme', '1')->save(); + $this->config('node.settings')->set('use_admin_theme', '1')->save(); $this->container->get('router.builder')->rebuild(); $this->drupalLogin($this->root_user); diff --git a/core/modules/simpletest/src/Tests/KernelTestBaseTest.php b/core/modules/simpletest/src/Tests/KernelTestBaseTest.php index 1fe5497..270e08c 100644 --- a/core/modules/simpletest/src/Tests/KernelTestBaseTest.php +++ b/core/modules/simpletest/src/Tests/KernelTestBaseTest.php @@ -285,7 +285,7 @@ function testEnableModulesTheme() { * Tests that there is no theme by default. */ function testNoThemeByDefault() { - $themes = $this->container->get('config.factory')->get('core.extension')->get('theme'); + $themes = $this->config('core.extension')->get('theme'); $this->assertEqual($themes, array()); $extensions = $this->container->get('config.storage')->read('core.extension'); diff --git a/core/modules/statistics/src/Tests/Views/IntegrationTest.php b/core/modules/statistics/src/Tests/Views/IntegrationTest.php index b26745a..d83a387 100644 --- a/core/modules/statistics/src/Tests/Views/IntegrationTest.php +++ b/core/modules/statistics/src/Tests/Views/IntegrationTest.php @@ -59,7 +59,7 @@ protected function setUp() { $this->node = $this->drupalCreateNode(array('type' => 'page')); // Enable access logging. - $this->container->get('config.factory')->get('statistics.settings') + $this->config('statistics.settings') ->set('access_log.enabled', 1) ->set('count_content_views', 1) ->save(); diff --git a/core/modules/system/src/Tests/Batch/PageTest.php b/core/modules/system/src/Tests/Batch/PageTest.php index 42800b7..1dd7628 100644 --- a/core/modules/system/src/Tests/Batch/PageTest.php +++ b/core/modules/system/src/Tests/Batch/PageTest.php @@ -30,7 +30,7 @@ function testBatchProgressPageTheme() { // Make sure that the page which starts the batch (an administrative page) // is using a different theme than would normally be used by the batch API. $this->container->get('theme_handler')->install(array('seven', 'bartik')); - $this->container->get('config.factory')->get('system.theme') + $this->config('system.theme') ->set('default', 'bartik') ->set('admin', 'seven') ->save(); diff --git a/core/modules/system/src/Tests/Entity/ConfigEntityImportTest.php b/core/modules/system/src/Tests/Entity/ConfigEntityImportTest.php index c266aa4..f7036d3 100644 --- a/core/modules/system/src/Tests/Entity/ConfigEntityImportTest.php +++ b/core/modules/system/src/Tests/Entity/ConfigEntityImportTest.php @@ -220,7 +220,7 @@ public function assertConfigUpdateImport($name, $original_data, $custom_data) { $this->container->get('config.storage.staging')->write($name, $custom_data); // Verify the active configuration still returns the default values. - $config = $this->container->get('config.factory')->get($name); + $config = $this->config($name); $this->assertIdentical($config->get(), $original_data); // Import. @@ -228,7 +228,7 @@ public function assertConfigUpdateImport($name, $original_data, $custom_data) { // Verify the values were updated. $this->container->get('config.factory')->reset($name); - $config = $this->container->get('config.factory')->get($name); + $config = $this->config($name); $this->assertIdentical($config->get(), $custom_data); } diff --git a/core/modules/system/src/Tests/Form/ConfirmFormTest.php b/core/modules/system/src/Tests/Form/ConfirmFormTest.php index fcb4e61..ffcc44a 100644 --- a/core/modules/system/src/Tests/Form/ConfirmFormTest.php +++ b/core/modules/system/src/Tests/Form/ConfirmFormTest.php @@ -26,7 +26,7 @@ class ConfirmFormTest extends WebTestBase { function testConfirmForm() { // Test the building of the form. $this->drupalGet('form-test/confirm-form'); - $site_name = $this->container->get('config.factory')->get('system.site')->get('name'); + $site_name = $this->config('system.site')->get('name'); $this->assertTitle(t('ConfirmFormTestForm::getQuestion(). | @site-name', array('@site-name' => $site_name)), 'The question was found as the page title.'); $this->assertText(t('ConfirmFormTestForm::getDescription().'), 'The description was used.'); $this->assertFieldByXPath('//input[@id="edit-submit"]', t('ConfirmFormTestForm::getConfirmText().'), 'The confirm text was used.'); diff --git a/core/modules/system/src/Tests/Menu/MenuRouterTest.php b/core/modules/system/src/Tests/Menu/MenuRouterTest.php index fbf9f77..61ec849 100644 --- a/core/modules/system/src/Tests/Menu/MenuRouterTest.php +++ b/core/modules/system/src/Tests/Menu/MenuRouterTest.php @@ -243,7 +243,7 @@ public function testThemeIntegration() { $theme_handler = $this->container->get('theme_handler'); $theme_handler->install(array($this->default_theme, $this->admin_theme)); - $this->container->get('config.factory')->get('system.theme') + $this->config('system.theme') ->set('default', $this->default_theme) ->set('admin', $this->admin_theme) ->save(); diff --git a/core/modules/system/src/Tests/System/TokenReplaceUnitTest.php b/core/modules/system/src/Tests/System/TokenReplaceUnitTest.php index 2f2b4f0..9a51f2f 100644 --- a/core/modules/system/src/Tests/System/TokenReplaceUnitTest.php +++ b/core/modules/system/src/Tests/System/TokenReplaceUnitTest.php @@ -85,7 +85,7 @@ public function testSystemSiteTokenReplacement() { $safe_slogan = Xss::filterAdmin($slogan); // Set a few site variables. - $config = $this->container->get('config.factory')->get('system.site'); + $config = $this->config('system.site'); $config ->set('name', 'Drupal') ->set('slogan', $slogan) diff --git a/core/modules/update/src/Tests/UpdateDeleteFileIfStaleTest.php b/core/modules/update/src/Tests/UpdateDeleteFileIfStaleTest.php index 7cafd11..9de98a4 100644 --- a/core/modules/update/src/Tests/UpdateDeleteFileIfStaleTest.php +++ b/core/modules/update/src/Tests/UpdateDeleteFileIfStaleTest.php @@ -39,8 +39,7 @@ function testUpdateDeleteFileIfStale() { // request, so the beginning of request will be before the file changes and // REQUEST_TIME - $filectime is negative. Set the maximum age to a number // even smaller than that. - $this->container->get('config.factory') - ->get('system.file') + $this->config('system.file') ->set('temporary_maximum_age', -100000) ->save(); diff --git a/core/modules/user/src/Tests/UserAccountFormFieldsTest.php b/core/modules/user/src/Tests/UserAccountFormFieldsTest.php index 384fee3..679eec0 100644 --- a/core/modules/user/src/Tests/UserAccountFormFieldsTest.php +++ b/core/modules/user/src/Tests/UserAccountFormFieldsTest.php @@ -55,8 +55,7 @@ function testUserRegistrationForm() { $this->installConfig(array('user')); // Disable email confirmation to unlock the password field. - $this->container->get('config.factory') - ->get('user.settings') + $this->config('user.settings') ->set('verify_mail', FALSE) ->save(); diff --git a/core/modules/user/src/Tests/UserPictureTest.php b/core/modules/user/src/Tests/UserPictureTest.php index 639c382..13feb0f 100644 --- a/core/modules/user/src/Tests/UserPictureTest.php +++ b/core/modules/user/src/Tests/UserPictureTest.php @@ -65,7 +65,7 @@ function testCreateDeletePicture() { // configuration value. db_update('file_managed') ->fields(array( - 'changed' => REQUEST_TIME - ($this->container->get('config.factory')->get('system.file')->get('temporary_maximum_age') + 1), + 'changed' => REQUEST_TIME - ($this->config('system.file')->get('temporary_maximum_age') + 1), )) ->condition('fid', $file->id()) ->execute(); @@ -91,14 +91,14 @@ function testPictureOnNodeComment() { $node = $this->drupalCreateNode(array('type' => 'article')); // Enable user pictures on nodes. - $this->container->get('config.factory')->get('system.theme.global')->set('features.node_user_picture', TRUE)->save(); + $this->config('system.theme.global')->set('features.node_user_picture', TRUE)->save(); // Verify that the image is displayed on the user account page. $this->drupalGet('node/' . $node->id()); $this->assertRaw(file_uri_target($file->getFileUri()), 'User picture found on node page.'); // Enable user pictures on comments, instead of nodes. - $this->container->get('config.factory')->get('system.theme.global') + $this->config('system.theme.global') ->set('features.node_user_picture', FALSE) ->set('features.comment_user_picture', TRUE) ->save(); @@ -113,7 +113,7 @@ function testPictureOnNodeComment() { $this->assertRaw(file_uri_target($file->getFileUri()), 'User picture found on comment.'); // Disable user pictures on comments and nodes. - $this->container->get('config.factory')->get('system.theme.global') + $this->config('system.theme.global') ->set('features.node_user_picture', FALSE) ->set('features.comment_user_picture', FALSE) ->save(); diff --git a/core/modules/user/src/Tests/Views/HandlerArgumentUserUidTest.php b/core/modules/user/src/Tests/Views/HandlerArgumentUserUidTest.php index 2327c58..01373fb 100644 --- a/core/modules/user/src/Tests/Views/HandlerArgumentUserUidTest.php +++ b/core/modules/user/src/Tests/Views/HandlerArgumentUserUidTest.php @@ -41,7 +41,7 @@ public function testArgumentTitle() { $view->destroy(); // Tests the anonymous user. - $anonymous = $this->container->get('config.factory')->get('user.settings')->get('anonymous'); + $anonymous = $this->config('user.settings')->get('anonymous'); $this->executeView($view, array(0)); $this->assertEqual($view->getTitle(), $anonymous); $view->destroy(); diff --git a/core/modules/views/src/Tests/Plugin/DisplayFeedTest.php b/core/modules/views/src/Tests/Plugin/DisplayFeedTest.php index 97e6e99..cef9bab 100644 --- a/core/modules/views/src/Tests/Plugin/DisplayFeedTest.php +++ b/core/modules/views/src/Tests/Plugin/DisplayFeedTest.php @@ -47,7 +47,7 @@ public function testFeedOutput() { // Test the site name setting. $site_name = $this->randomMachineName(); - $this->container->get('config.factory')->get('system.site')->set('name', $site_name)->save(); + $this->config('system.site')->set('name', $site_name)->save(); $this->drupalGet('test-feed-display.xml'); $result = $this->xpath('//title'); diff --git a/core/profiles/standard/src/Tests/StandardTest.php b/core/profiles/standard/src/Tests/StandardTest.php index 567cb9f..f8d4999 100644 --- a/core/profiles/standard/src/Tests/StandardTest.php +++ b/core/profiles/standard/src/Tests/StandardTest.php @@ -98,11 +98,10 @@ function testStandard() { // conformance. Ensures all imported default configuration is valid when // standard profile modules are enabled. $names = $this->container->get('config.storage')->listAll(); - $factory = $this->container->get('config.factory'); /** @var \Drupal\Core\Config\TypedConfigManagerInterface $typed_config */ $typed_config = $this->container->get('config.typed'); foreach ($names as $name) { - $config = $factory->get($name); + $config = $this->config($name); $this->assertConfigSchema($typed_config, $name, $config->get()); }