function ColorTest::testOverrideAndResetScheme
Same name in other branches
- 8.9.x core/modules/color/tests/src/Functional/ColorTest.php \Drupal\Tests\color\Functional\ColorTest::testOverrideAndResetScheme()
Tests whether the scheme can be set, viewed anonymously and reset.
File
-
core/
modules/ color/ tests/ src/ Functional/ ColorTest.php, line 161
Class
- ColorTest
- Modify theme colors and make sure the changes are reflected on the frontend.
Namespace
Drupal\Tests\color\FunctionalCode
public function testOverrideAndResetScheme() : void {
$settings_path = 'admin/appearance/settings/color_test_theme';
$assert_session = $this->assertSession();
// Place branding block with site name and slogan into header region.
$this->drupalPlaceBlock('system_branding_block', [
'region' => 'header',
]);
$this->drupalGet('');
// Make sure the color logo is not being used.
$assert_session->responseNotContains('files/color/color_test_theme-');
// Make sure the original color_test_theme logo exists.
$assert_session->responseContains('color_test_theme/logo.svg');
// Log in and set the color scheme to 'custom'.
$this->drupalLogin($this->bigUser);
$edit['scheme'] = 'custom';
$this->drupalGet($settings_path);
$this->submitForm($edit, 'Save configuration');
// Visit the homepage and ensure color changes.
$this->drupalLogout();
$this->drupalGet('');
// Make sure the color logo is being used.
$assert_session->responseContains('files/color/color_test_theme-');
// Make sure the original color_test_theme logo does not exist.
$assert_session->responseNotContains('color_test_theme/logo.svg');
// Log in and set the color scheme back to default (delete config).
$this->drupalLogin($this->bigUser);
$edit['scheme'] = 'default';
$this->drupalGet($settings_path);
$this->submitForm($edit, 'Save configuration');
// Log out and ensure there is no color and we have the original logo.
$this->drupalLogout();
$this->drupalGet('');
// Make sure the color logo is not being used.
$assert_session->responseNotContains('files/color/color_test_theme-');
// Make sure the original color_test_theme logo exists.
$assert_session->responseContains('color_test_theme/logo.svg');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.