ConfigFormOverrideTest.php in Zircon Profile 8
File
core/modules/config/src/Tests/ConfigFormOverrideTest.php
View source
<?php
namespace Drupal\config\Tests;
use Drupal\simpletest\WebTestBase;
class ConfigFormOverrideTest extends WebTestBase {
public function testFormsWithOverrides() {
$this
->drupalLogin($this
->drupalCreateUser(array(
'access administration pages',
'administer site configuration',
)));
$overridden_name = 'Site name global conf override';
$settings['config']['system.site']['name'] = (object) array(
'value' => $overridden_name,
'required' => TRUE,
);
$this
->writeSettings($settings);
$this
->drupalGet('admin/config/system/site-information');
$this
->assertTitle('Site information | ' . $overridden_name);
$elements = $this
->xpath('//input[@name="site_name"]');
$this
->assertIdentical((string) $elements[0]['value'], 'Drupal');
$edit = array(
'site_name' => 'Custom site name',
);
$this
->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration'));
$this
->assertTitle('Site information | ' . $overridden_name);
$elements = $this
->xpath('//input[@name="site_name"]');
$this
->assertIdentical((string) $elements[0]['value'], $edit['site_name']);
}
}