ConfigFormOverrideTest.php in Drupal 9
File
core/modules/config/tests/src/Functional/ConfigFormOverrideTest.php
View source
<?php
namespace Drupal\Tests\config\Functional;
use Drupal\Tests\BrowserTestBase;
class ConfigFormOverrideTest extends BrowserTestBase {
protected $defaultTheme = 'stark';
public function testFormsWithOverrides() {
$this
->drupalLogin($this
->drupalCreateUser([
'access administration pages',
'administer site configuration',
]));
$overridden_name = 'Site name global conf override';
$settings['config']['system.site']['name'] = (object) [
'value' => $overridden_name,
'required' => TRUE,
];
$this
->writeSettings($settings);
$this
->drupalGet('admin/config/system/site-information');
$this
->assertSession()
->titleEquals('Basic site settings | ' . $overridden_name);
$this
->assertSession()
->fieldValueEquals("site_name", 'Drupal');
$edit = [
'site_name' => 'Custom site name',
];
$this
->drupalGet('admin/config/system/site-information');
$this
->submitForm($edit, 'Save configuration');
$this
->assertSession()
->titleEquals('Basic site settings | ' . $overridden_name);
$this
->assertSession()
->fieldValueEquals("site_name", $edit['site_name']);
}
}