function ColorTest::testValidColor in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/color/src/Tests/ColorTest.php \Drupal\color\Tests\ColorTest::testValidColor()
Tests whether the provided color is valid.
File
- core/
modules/ color/ src/ Tests/ ColorTest.php, line 159 - Contains \Drupal\color\Tests\ColorTest.
Class
- ColorTest
- Modify the Bartik theme colors and make sure the changes are reflected on the frontend.
Namespace
Drupal\color\TestsCode
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
->drupalPostForm($settings_path, $edit, t('Save configuration'));
if ($is_valid) {
$this
->assertText('The configuration options have been saved.');
}
else {
$this
->assertText('You must enter a valid hexadecimal color value for Main background.');
}
}
}