3 namespace Drupal\Tests\config\Functional;
5 use Drupal\Tests\BrowserTestBase;
8 * Tests config overrides do not appear on forms that extend ConfigFormBase.
11 * @see \Drupal\Core\Form\ConfigFormBase
13 class ConfigFormOverrideTest extends BrowserTestBase {
16 * Tests that overrides do not affect forms.
18 public function testFormsWithOverrides() {
19 $this->drupalLogin($this->drupalCreateUser(['access administration pages', 'administer site configuration']));
21 $overridden_name = 'Site name global conf override';
23 // Set up an override.
24 $settings['config']['system.site']['name'] = (object) [
25 'value' => $overridden_name,
28 $this->writeSettings($settings);
30 // Test that everything on the form is the same, but that the override
31 // worked for the actual site name.
32 $this->drupalGet('admin/config/system/site-information');
33 $this->assertTitle('Basic site settings | ' . $overridden_name);
34 $elements = $this->xpath('//input[@name="site_name"]');
35 $this->assertIdentical($elements[0]->getValue(), 'Drupal');
37 // Submit the form and ensure the site name is not changed.
39 'site_name' => 'Custom site name',
41 $this->drupalPostForm('admin/config/system/site-information', $edit, t('Save configuration'));
42 $this->assertTitle('Basic site settings | ' . $overridden_name);
43 $elements = $this->xpath('//input[@name="site_name"]');
44 $this->assertIdentical($elements[0]->getValue(), $edit['site_name']);