class ConfigFormOverrideTest
Same name and namespace in other branches
- 11.x core/modules/config/tests/src/Functional/ConfigFormOverrideTest.php \Drupal\Tests\config\Functional\ConfigFormOverrideTest
- 10 core/modules/config/tests/src/Functional/ConfigFormOverrideTest.php \Drupal\Tests\config\Functional\ConfigFormOverrideTest
- 8.9.x core/modules/config/tests/src/Functional/ConfigFormOverrideTest.php \Drupal\Tests\config\Functional\ConfigFormOverrideTest
Tests config overrides do not appear on forms that extend ConfigFormBase.
@group config
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\config\Functional\ConfigFormOverrideTest extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of ConfigFormOverrideTest
See also
\Drupal\Core\Form\ConfigFormBase
File
-
core/
modules/ config/ tests/ src/ Functional/ ConfigFormOverrideTest.php, line 13
Namespace
Drupal\Tests\config\FunctionalView source
class ConfigFormOverrideTest extends BrowserTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Tests that overrides do not affect forms.
*/
public function testFormsWithOverrides() {
$this->drupalLogin($this->drupalCreateUser([
'access administration pages',
'administer site configuration',
]));
$overridden_name = 'Site name global conf override';
// Set up an override.
$settings['config']['system.site']['name'] = (object) [
'value' => $overridden_name,
'required' => TRUE,
];
$this->writeSettings($settings);
// Test that everything on the form is the same, but that the override
// worked for the actual site name.
$this->drupalGet('admin/config/system/site-information');
$this->assertSession()
->titleEquals('Basic site settings | ' . $overridden_name);
$this->assertSession()
->fieldValueEquals("site_name", 'Drupal');
// Submit the form and ensure the site name is not changed.
$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']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.