diff --git a/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php b/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php index 4a7186f..ab525dd 100644 --- a/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php +++ b/core/modules/search/lib/Drupal/search/Tests/SearchConfigSettingsFormTest.php @@ -51,7 +51,7 @@ function setUp() { search_update_totals(); // Enable the search block. - $this->drupalPlaceBlock('search'); + $this->drupalPlaceBlock('search_form_block'); } /** diff --git a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php index d80a76e..713839e 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -377,7 +377,7 @@ protected function drupalCreateContentType($settings = array()) { protected function drupalPlaceBlock($plugin_id, array $settings = array(), $theme = NULL) { // Confirm that the active user has permission to add the block instance. // @todo Remove this check once it is possible to do this programmatically. - if (!user_access('administer blocks', $this->loggedInUser)) { + if (!empty($this->loggedInUser) && !user_access('administer blocks', $this->loggedInUser)) { $this->fail('The logged in user does not have permission to administer blocks.'); return FALSE; } diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php index 1efb7fb..1843c8b 100644 --- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php +++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsReportsTest.php @@ -88,6 +88,7 @@ function testPopularContentBlock() { // Configure and save the block. $this->drupalPlaceBlock('statistics_popular_block', array( + 'title' => 'Popular content', 'statistics_block_top_day_num' => 3, 'statistics_block_top_all_num' => 3, 'statistics_block_top_last_num' => 3, diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/BlockUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/BlockUpgradePathTest.php index 1ca6e9a..1778284 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/BlockUpgradePathTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/BlockUpgradePathTest.php @@ -42,9 +42,16 @@ public function testBlockUpgradeTitleLength() { $this->drupalGet(''); $this->assertText($title, 'Block with title longer than 64 characters successfully created.'); - // Add a new custom block with a title over 255 characters. - $longer_title = $this->randomName(256); - $this->drupalPlaceBlock('system_powered_by_block', array('title' => $longer_title)); + // Try to add a block with a title over 255 characters. + // WebTestBase::drupalPlaceBlock() asserts that the block is created + // successfully. In this case we expect the block creation to fail, so + // create a new instance of the block manually. + $settings = array( + 'title' => $this->randomName(256), + 'machine_name' => strtolower($this->randomName(8)), + 'region' => 'sidebar_first', + ); + $this->drupalPost('admin/structure/block/manage/system_powered_by_block/' . variable_get('theme_default', 'stark'), $settings, t('Save block')); // Confirm that the custom block cannot be created with title longer than // the maximum number of characters.