diff -u b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php --- b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php +++ b/core/modules/shortcut/src/Tests/ShortcutLinksTest.php @@ -24,7 +24,7 @@ * * @var array */ - public static $modules = array('router_test', 'views'); + public static $modules = array('router_test', 'views', 'block'); /** * Tests that creating a shortcut works properly. @@ -333,23 +333,11 @@ */ public function testShortcutBlockAccess() { $this->drupalLogin($this->adminUser); - $block_name = 'shortcuts'; - // Create a random title for the block. - $title = $this->randomMachineName(8); - // Get the default theme. - $default_theme = $this->config('system.theme')->get('default'); - $edit = array( - 'id' => strtolower($this->randomMachineName(8)), - 'settings[label]' => $title, - ); - - // Assign block to sidebar first region. - $edit['region'] = 'sidebar_first'; - $this->drupalPostForm('admin/structure/block/add/' . $block_name . '/' . $default_theme, $edit, t('Save block')); - $this->assertText('The block configuration has been saved.', 'Block was saved'); + // Creates a block instance and place in a region through api. + $block = $this->drupalPlaceBlock('shortcuts'); $this->drupalGet(''); - $this->assertText($title, 'Block was displayed on the front page.'); + $this->assertBlockAppears($block); $this->drupalLogout(); @@ -357,7 +345,7 @@ // shortcut block. $this->drupalLogin($this->shortcutUser); $this->drupalGet(''); - $this->assertText($title, 'Block was displayed on the front page.'); + $this->assertBlockAppears($block); $this->drupalLogout(); @@ -365,7 +353,7 @@ // shortcut block. $this->drupalLogin($this->drupalCreateUser(array())); $this->drupalGet(''); - $this->assertNoText($title, 'Block was not displayed on the front page.'); + $this->assertNoBlockAppears($block); } } reverted: --- b/core/modules/shortcut/src/Tests/ShortcutTestBase.php +++ a/core/modules/shortcut/src/Tests/ShortcutTestBase.php @@ -22,7 +22,7 @@ * * @var array */ + public static $modules = array('node', 'toolbar', 'shortcut'); - public static $modules = array('node', 'toolbar', 'shortcut', 'block'); /** * User with permission to administer shortcuts. @@ -83,7 +83,7 @@ } // Create users. + $this->adminUser = $this->drupalCreateUser(array('access toolbar', 'administer shortcuts', 'view the administration theme', 'create article content', 'create page content', 'access content overview', 'administer users', 'link to any page', 'edit any article content')); - $this->adminUser = $this->drupalCreateUser(array('access toolbar', 'administer blocks', 'administer shortcuts', 'access shortcuts', 'view the administration theme', 'create article content', 'create page content', 'access content overview', 'administer users', 'link to any page', 'edit any article content')); $this->shortcutUser = $this->drupalCreateUser(array('customize shortcut links', 'switch shortcut sets', 'access shortcuts', 'access content')); // Create a node.