ThemeTokenTest.php in Zircon Profile 8
File
core/modules/system/src/Tests/Theme/ThemeTokenTest.php
View source
<?php
namespace Drupal\system\Tests\Theme;
use Drupal\simpletest\WebTestBase;
class ThemeTokenTest extends WebTestBase {
public static $modules = [
'block',
];
protected function setUp() {
parent::setUp();
$account = $this
->drupalCreateUser([
'administer blocks',
'view the administration theme',
]);
$this
->drupalLogin($account);
}
public function testThemeToken() {
$this
->drupalGet('admin/structure/block');
$settings = $this
->getDrupalSettings();
$this
->assertNull($settings['ajaxPageState']['theme_token']);
$this->container
->get('theme_installer')
->install([
'seven',
]);
$this
->config('system.theme')
->set('admin', 'seven')
->save();
$this
->drupalGet('admin/structure/block');
$settings = $this
->getDrupalSettings();
$this
->assertNotNull($settings['ajaxPageState']['theme_token']);
$this
->assertTrue(is_string($settings['ajaxPageState']['theme_token']));
$this
->assertEqual(strlen($settings['ajaxPageState']['theme_token']), 43);
}
}
Classes
Name |
Description |
ThemeTokenTest |
Tests the generation of 'theme_token' key in Drupal settings. |