diff --git a/core/modules/aggregator/src/Tests/AggregatorTestBase.php b/core/modules/aggregator/src/Tests/AggregatorTestBase.php index 616e1e2..cf845db 100644 --- a/core/modules/aggregator/src/Tests/AggregatorTestBase.php +++ b/core/modules/aggregator/src/Tests/AggregatorTestBase.php @@ -136,7 +136,7 @@ function getFeedEditObject($feed_url = NULL, array $values = array()) { */ function getDefaultFeedItemCount() { // Our tests are based off of rss.xml, so let's find out how many elements should be related. - $feed_count = db_query_range('SELECT COUNT(DISTINCT nid) FROM {node_field_data} n WHERE n.promote = 1 AND n.status = 1', 0, $this->container->get('config.factory')->get('system.rss')->get('items.limit'))->fetchField(); + $feed_count = db_query_range('SELECT COUNT(DISTINCT nid) FROM {node_field_data} n WHERE n.promote = 1 AND n.status = 1', 0, $this->config('system.rss')->get('items.limit'))->fetchField(); return $feed_count > 10 ? 10 : $feed_count; } @@ -336,7 +336,7 @@ function createSampleNodes($count = 5) { * Enable the plugins coming with aggregator_test module. */ function enableTestPlugins() { - $this->container->get('config.factory')->get('aggregator.settings') + $this->config('aggregator.settings') ->set('fetcher', 'aggregator_test_fetcher') ->set('parser', 'aggregator_test_parser') ->set('processors', array( diff --git a/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php b/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php index ae914d8..cacf88d 100644 --- a/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php +++ b/core/modules/locale/src/Tests/LocaleConfigTranslationImportTest.php @@ -36,7 +36,7 @@ protected function setUp() { // Update module should not go out to d.o to check for updates. We override // the url to an invalid update source. No update data will be found. - \Drupal::config('update.settings')->set('fetch.url', (string) Url::fromRoute('', array(), array('absolute' => TRUE)))->save(); + $this->config('update.settings')->set('fetch.url', (string) Url::fromRoute('', array(), array('absolute' => TRUE)))->save(); } /** @@ -54,7 +54,7 @@ public function testConfigTranslationImport() { // 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/system/src/Tests/Mail/MailTest.php b/core/modules/system/src/Tests/Mail/MailTest.php index c82a152..3603332 100644 --- a/core/modules/system/src/Tests/Mail/MailTest.php +++ b/core/modules/system/src/Tests/Mail/MailTest.php @@ -48,7 +48,7 @@ public function testPluggableFramework() { $this->assertTrue($mail_backend instanceof TestPhpMailFailure, 'Default mail interface can be swapped.'); // Add a module-specific mail backend. - \Drupal::config('system.mail')->set('interface.mymodule_testkey', 'test_mail_collector')->save(); + $this->config('system.mail')->set('interface.mymodule_testkey', 'test_mail_collector')->save(); // Get the added MailInterface class instance. $mail_backend = \Drupal::service('plugin.manager.mail')->getInstance(array('module' => 'mymodule', 'key' => 'testkey')); diff --git a/core/modules/tour/src/Tests/TourTestBasic.php b/core/modules/tour/src/Tests/TourTestBasic.php index 5cf9322..160f782 100644 --- a/core/modules/tour/src/Tests/TourTestBasic.php +++ b/core/modules/tour/src/Tests/TourTestBasic.php @@ -50,8 +50,7 @@ protected function setUp() { // Make sure we are using distinct default and administrative themes for // the duration of these tests. $this->container->get('theme_handler')->install(array('bartik', 'seven')); - $this->container->get('config.factory') - ->get('system.theme') + $this->config('system.theme') ->set('default', 'bartik') ->set('admin', 'seven') ->save(); diff --git a/core/tests/Drupal/Tests/Core/DrupalTest.php b/core/tests/Drupal/Tests/Core/DrupalTest.php index 4af023d..8a36cfd 100644 --- a/core/tests/Drupal/Tests/Core/DrupalTest.php +++ b/core/tests/Drupal/Tests/Core/DrupalTest.php @@ -133,6 +133,7 @@ public function testConfig() { ->will($this->returnValue(TRUE)); $this->setMockContainerService('config.factory', $config); + // Test \Drupal::config(), not $this->config(). $this->assertNotNull(\Drupal::config('test_config')); }