ColorSafePreviewTest.php in Drupal 8
File
core/modules/color/tests/src/Functional/ColorSafePreviewTest.php
View source
<?php
namespace Drupal\Tests\color\Functional;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
class ColorSafePreviewTest extends BrowserTestBase {
public static $modules = [
'color',
'color_test',
];
protected $defaultTheme = 'stark';
protected $bigUser;
protected function setUp() {
parent::setUp();
$this->bigUser = $this
->drupalCreateUser([
'administer themes',
]);
}
public function testColorPreview() {
\Drupal::service('theme_installer')
->install([
'color_test_theme',
]);
$this
->drupalLogin($this->bigUser);
$url = Url::fromRoute('system.theme_settings_theme', [
'theme' => 'color_test_theme',
]);
$this
->drupalGet($url);
$this
->assertText('TEST COLOR PREVIEW');
$this
->assertNoRaw('<script>alert("security filter test");</script>');
$this
->assertRaw('<h2>TEST COLOR PREVIEW</h2>');
}
}