public function ColorTest::testValidColor in Drupal 9
Same name and namespace in other branches
- 8 core/modules/color/tests/src/Functional/ColorTest.php \Drupal\Tests\color\Functional\ColorTest::testValidColor()
Tests whether the provided color is valid.
File
- core/
modules/ color/ tests/ src/ Functional/ ColorTest.php, line 164
Class
- ColorTest
- Modify the Bartik theme colors and make sure the changes are reflected on the frontend.
Namespace
Drupal\Tests\color\FunctionalCode
public function testValidColor() {
$this
->config('system.theme')
->set('default', 'bartik')
->save();
$settings_path = 'admin/appearance/settings/bartik';
$this
->drupalLogin($this->bigUser);
$edit['scheme'] = '';
foreach ($this->colorTests as $color => $is_valid) {
$edit['palette[bg]'] = $color;
$this
->drupalGet($settings_path);
$this
->submitForm($edit, 'Save configuration');
if ($is_valid) {
$this
->assertSession()
->pageTextContains('The configuration options have been saved.');
}
else {
$this
->assertSession()
->pageTextContains('You must enter a valid hexadecimal color value for Main background.');
}
}
}