Commit 95d4c594 authored by catch's avatar catch

Issue #2395395 by alexpott, effulgentsia, Gábor Hojtsy: TestBase lacks a...

Issue #2395395 by alexpott, effulgentsia, Gábor Hojtsy: TestBase lacks a config method to be used consistently in tests
parent 37cdcf8d
......@@ -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(
......
......@@ -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.
......
......@@ -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();
......
......@@ -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());
}
......
......@@ -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
......
......@@ -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.');
......
......@@ -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']);
......
......@@ -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();
......
......@@ -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.
......@@ -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');
......@@ -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();
......
......@@ -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();
}
......
......@@ -38,7 +38,7 @@ function testXSSInTitle() {
$this->assertNoRaw('<script>alert("XSS label");</script>', '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("<script>alert('XSS subject');</script>", 'The block title was properly sanitized in Block Plugin UI Admin page.');
}
......
......@@ -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();
......
......@@ -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.');
......
......@@ -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()));
......
......@@ -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]']),
......
......@@ -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();
......
......@@ -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');
}
/**
......
......@@ -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();
......
......@@ -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')->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.');
}
......
......@@ -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('<front>');
$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('<front>');
$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('<front>');
......@@ -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';
......
......@@ -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();
......
......@@ -41,7 +41,7 @@ function testCommentPreview() {
// Login as web user and add a signature and a user picture.
$this->drupalLogin($this->webUser);
\Drupal::config('user.settings')->set('signatures', 1)->save();
$this->config('user.settings')->set('signatures', 1)->save();
$test_signature = $this->randomMachineName();
$edit['signature[value]'] = '<a href="http://example.com/">' . $test_signature. '</a>';
$image = current($this->drupalGetTestFiles('image'));
......
......@@ -44,9 +44,10 @@ class ConfigCRUDTest extends KernelTestBase {
*/
function testCRUD() {
$storage = $this->container->get('config.storage');
$config_factory = $this->container->get('config.factory');
$name = 'config_test.crud';
$config = \Drupal::config($name);
$config = $this->config($name);
$this->assertIdentical($config->isNew(), TRUE);
// Create a new configuration object.
......@@ -67,15 +68,15 @@ 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);
// 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,16 +87,16 @@ 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);
$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);
......@@ -108,49 +109,48 @@ 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.
$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.
$new_config = \Drupal::config($new_name);
$new_config = $this->config($new_name);
$expected_values = array(
'value' => 'herp',
'404' => 'derp',
......@@ -169,7 +169,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) {
......@@ -180,7 +180,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) {
......@@ -192,7 +192,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) {
......@@ -207,7 +207,7 @@ function testNameValidation() {