update
This commit is contained in:
@@ -28,7 +28,10 @@ class BlockAdminThemeTest extends BrowserTestBase {
|
||||
*/
|
||||
public function testAdminTheme() {
|
||||
// Create administrative user.
|
||||
$admin_user = $this->drupalCreateUser(['administer blocks', 'administer themes']);
|
||||
$admin_user = $this->drupalCreateUser([
|
||||
'administer blocks',
|
||||
'administer themes',
|
||||
]);
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
// Ensure that access to block admin page is denied when theme is not
|
||||
|
||||
@@ -56,7 +56,10 @@ class BlockCacheTest extends BrowserTestBase {
|
||||
parent::setUp();
|
||||
|
||||
// Create an admin user, log in and enable test blocks.
|
||||
$this->adminUser = $this->drupalCreateUser(['administer blocks', 'access administration pages']);
|
||||
$this->adminUser = $this->drupalCreateUser([
|
||||
'administer blocks',
|
||||
'access administration pages',
|
||||
]);
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
||||
// Create additional users to test caching modes.
|
||||
|
||||
@@ -28,7 +28,10 @@ class BlockDemoTest extends BrowserTestBase {
|
||||
*/
|
||||
public function testBlockDemo() {
|
||||
// Create administrative user.
|
||||
$admin_user = $this->drupalCreateUser(['administer blocks', 'administer themes']);
|
||||
$admin_user = $this->drupalCreateUser([
|
||||
'administer blocks',
|
||||
'administer themes',
|
||||
]);
|
||||
$this->drupalLogin($admin_user);
|
||||
|
||||
// Confirm we have access to the block demo page for the default theme.
|
||||
|
||||
@@ -33,7 +33,10 @@ class BlockLanguageTest extends BrowserTestBase {
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->adminUser = $this->drupalCreateUser(['administer blocks', 'administer languages']);
|
||||
$this->adminUser = $this->drupalCreateUser([
|
||||
'administer blocks',
|
||||
'administer languages',
|
||||
]);
|
||||
$this->drupalLogin($this->adminUser);
|
||||
|
||||
// Add predefined language.
|
||||
|
||||
@@ -152,9 +152,9 @@ class BlockUiTest extends BrowserTestBase {
|
||||
\Drupal::service('theme_installer')->install(['stable', 'stark']);
|
||||
$this->drupalGet('admin/structure/block');
|
||||
$theme_handler = \Drupal::service('theme_handler');
|
||||
$this->assertLink($theme_handler->getName('classy'));
|
||||
$this->assertLink($theme_handler->getName('stark'));
|
||||
$this->assertNoLink($theme_handler->getName('stable'));
|
||||
$this->assertSession()->linkExists($theme_handler->getName('classy'));
|
||||
$this->assertSession()->linkExists($theme_handler->getName('stark'));
|
||||
$this->assertSession()->linkNotExists($theme_handler->getName('stable'));
|
||||
|
||||
// Ensure that a hidden theme cannot use the block demo page.
|
||||
$this->drupalGet('admin/structure/block/list/stable');
|
||||
@@ -166,7 +166,7 @@ class BlockUiTest extends BrowserTestBase {
|
||||
\Drupal::service('router.builder')->rebuildIfNeeded();
|
||||
$this->drupalPlaceBlock('local_tasks_block', ['region' => 'header', 'theme' => 'stable']);
|
||||
$this->drupalGet('admin/structure/block');
|
||||
$this->assertLink($theme_handler->getName('stable'));
|
||||
$this->assertSession()->linkExists($theme_handler->getName('stable'));
|
||||
$this->drupalGet('admin/structure/block/list/stable');
|
||||
$this->assertSession()->statusCodeEquals(200);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,10 @@ class BlockXssTest extends BrowserTestBase {
|
||||
* Tests that nothing is escaped other than the blocks explicitly tested.
|
||||
*/
|
||||
public function testNoUnexpectedEscaping() {
|
||||
$this->drupalLogin($this->drupalCreateUser(['administer blocks', 'access administration pages']));
|
||||
$this->drupalLogin($this->drupalCreateUser([
|
||||
'administer blocks',
|
||||
'access administration pages',
|
||||
]));
|
||||
$this->drupalGet(Url::fromRoute('block.admin_display'));
|
||||
$this->clickLink('Place block');
|
||||
$this->assertNoEscaped('<');
|
||||
@@ -49,7 +52,10 @@ class BlockXssTest extends BrowserTestBase {
|
||||
$this->drupalGet('');
|
||||
$this->assertNoRaw('<script>alert("XSS label");</script>', 'The block title was properly sanitized when rendered.');
|
||||
|
||||
$this->drupalLogin($this->drupalCreateUser(['administer blocks', 'access administration pages']));
|
||||
$this->drupalLogin($this->drupalCreateUser([
|
||||
'administer blocks',
|
||||
'access administration pages',
|
||||
]));
|
||||
$default_theme = $this->config('system.theme')->get('default');
|
||||
$this->drupalGet('admin/structure/block/list/' . $default_theme);
|
||||
$this->assertNoRaw("<script>alert('XSS subject');</script>", 'The block title was properly sanitized in Block Plugin UI Admin page.');
|
||||
@@ -61,7 +67,10 @@ class BlockXssTest extends BrowserTestBase {
|
||||
public function testXssInCategory() {
|
||||
$this->container->get('module_installer')->install(['block_test']);
|
||||
$this->drupalPlaceBlock('test_xss_title');
|
||||
$this->drupalLogin($this->drupalCreateUser(['administer blocks', 'access administration pages']));
|
||||
$this->drupalLogin($this->drupalCreateUser([
|
||||
'administer blocks',
|
||||
'access administration pages',
|
||||
]));
|
||||
$this->drupalGet(Url::fromRoute('block.admin_display'));
|
||||
$this->clickLink('Place block');
|
||||
$this->assertNoRaw("<script>alert('XSS category');</script>");
|
||||
|
||||
@@ -36,7 +36,10 @@ class NonDefaultBlockAdminTest extends BrowserTestBase {
|
||||
* Test non-default theme admin.
|
||||
*/
|
||||
public function testNonDefaultBlockAdmin() {
|
||||
$admin_user = $this->drupalCreateUser(['administer blocks', 'administer themes']);
|
||||
$admin_user = $this->drupalCreateUser([
|
||||
'administer blocks',
|
||||
'administer themes',
|
||||
]);
|
||||
$this->drupalLogin($admin_user);
|
||||
$new_theme = 'bartik';
|
||||
\Drupal::service('theme_installer')->install([$new_theme]);
|
||||
|
||||
@@ -65,7 +65,10 @@ class DisplayBlockTest extends ViewTestBase {
|
||||
* Tests default and custom block categories.
|
||||
*/
|
||||
public function testBlockCategory() {
|
||||
$this->drupalLogin($this->drupalCreateUser(['administer views', 'administer blocks']));
|
||||
$this->drupalLogin($this->drupalCreateUser([
|
||||
'administer views',
|
||||
'administer blocks',
|
||||
]));
|
||||
|
||||
// Create a new view in the UI.
|
||||
$edit = [];
|
||||
@@ -368,7 +371,11 @@ class DisplayBlockTest extends ViewTestBase {
|
||||
* Tests the contextual links on a Views block.
|
||||
*/
|
||||
public function testBlockContextualLinks() {
|
||||
$this->drupalLogin($this->drupalCreateUser(['administer views', 'access contextual links', 'administer blocks']));
|
||||
$this->drupalLogin($this->drupalCreateUser([
|
||||
'administer views',
|
||||
'access contextual links',
|
||||
'administer blocks',
|
||||
]));
|
||||
$block = $this->drupalPlaceBlock('views_block:test_view_block-block_1');
|
||||
$cached_block = $this->drupalPlaceBlock('views_block:test_view_block-block_1');
|
||||
$this->drupalGet('test-page');
|
||||
|
||||
Reference in New Issue
Block a user