diff --git a/core/modules/block/block.module b/core/modules/block/block.module index e415524..7e39da4 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -5,7 +5,6 @@ * Controls the visual building blocks a page is constructed with. */ -use Drupal\block\BlockInterface; use Drupal\Component\Utility\Html; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Url; diff --git a/core/modules/block/src/Tests/Update/BlockRemoveDisabledRegionUpdateTest.php b/core/modules/block/src/Tests/Update/BlockRemoveDisabledRegionUpdateTest.php index 0d9826f..60ba24c 100644 --- a/core/modules/block/src/Tests/Update/BlockRemoveDisabledRegionUpdateTest.php +++ b/core/modules/block/src/Tests/Update/BlockRemoveDisabledRegionUpdateTest.php @@ -1,14 +1,7 @@ assertTrue($block instanceof Block); $this->assertIdentical($visibility, $block->getVisibility()); $this->assertIdentical($region, $block->getRegion()); $this->assertIdentical($theme, $block->getTheme()); $this->assertIdentical($weight, $block->getWeight()); + $this->assertIdentical($status, $block->status()); $config = $this->config('block.block.' . $id); $this->assertIdentical($label, $config->get('settings.label')); @@ -123,7 +124,9 @@ public function testBlockMigration() { $visibility['request_path']['id'] = 'request_path'; $visibility['request_path']['negate'] = TRUE; $visibility['request_path']['pages'] = '/node/1'; - $this->assertEntity('system', $visibility, 'footer', 'bartik', -5, '', '0'); + // @todo https://www.drupal.org/node/2753939 This block is the footer region + // but Bartik in D8 does not have this region. + $this->assertEntity('system', $visibility, 'header', 'bartik', -5, '', '0', FALSE); // Check menu blocks $visibility = []; @@ -138,7 +141,9 @@ public function testBlockMigration() { $visibility['request_path']['id'] = 'request_path'; $visibility['request_path']['negate'] = FALSE; $visibility['request_path']['pages'] = '/node'; - $this->assertEntity('block_1', $visibility, 'sidebar_second', 'bluemarine', -4, 'Another Static Block', 'visible'); + // @todo https://www.drupal.org/node/2753939 The bluemarine theme does not + // exist. + $this->assertEntity('block_1', $visibility, '', 'bluemarine', -4, 'Another Static Block', 'visible', FALSE); $visibility = []; $this->assertEntity('block_2', $visibility, 'right', 'test_theme', -7, '', '0'); diff --git a/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php b/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php index ce7992d..5d3db08 100644 --- a/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php +++ b/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php @@ -78,7 +78,7 @@ protected function setUp() { * @param string $label_display * The block label display setting. */ - public function assertEntity($id, $plugin_id, array $roles, $pages, $region, $theme, $weight, $label, $label_display) { + public function assertEntity($id, $plugin_id, array $roles, $pages, $region, $theme, $weight, $label, $label_display, $status = TRUE) { $block = Block::load($id); $this->assertTrue($block instanceof Block); /** @var \Drupal\block\BlockInterface $block */ @@ -96,6 +96,7 @@ public function assertEntity($id, $plugin_id, array $roles, $pages, $region, $th $this->assertIdentical($region, $block->getRegion()); $this->assertIdentical($theme, $block->getTheme()); $this->assertIdentical($weight, $block->getWeight()); + $this->assertIdentical($status, $block->status()); $config = $this->config('block.block.' . $id); $this->assertIdentical($label, $config->get('settings.label')); @@ -109,7 +110,9 @@ public function testBlockMigration() { $this->assertEntity('bartik_system_main', 'system_main_block', [], '', 'content', 'bartik', 0, '', '0'); $this->assertEntity('bartik_search_form', 'search_form_block', [], '', 'sidebar_first', 'bartik', -1, '', '0'); $this->assertEntity('bartik_user_login', 'user_login_block', [], '', 'sidebar_first', 'bartik', 0, '', '0'); - $this->assertEntity('bartik_system_powered_by', 'system_powered_by_block', [], '', 'footer', 'bartik', 10, '', '0'); + // @todo https://www.drupal.org/node/2753939 This block is the footer region + // but Bartik in D8 does not have this region. + $this->assertEntity('bartik_system_powered_by', 'system_powered_by_block', [], '', 'header', 'bartik', 10, '', '0', FALSE); $this->assertEntity('seven_system_main', 'system_main_block', [], '', 'content', 'seven', 0, '', '0'); $this->assertEntity('seven_user_login', 'user_login_block', [], '', 'content', 'seven', 10, '', '0'); diff --git a/core/modules/rest/src/Tests/RESTTestBase.php b/core/modules/rest/src/Tests/RESTTestBase.php index 4779b6b..e9f054b 100644 --- a/core/modules/rest/src/Tests/RESTTestBase.php +++ b/core/modules/rest/src/Tests/RESTTestBase.php @@ -258,6 +258,15 @@ protected function entityValues($entity_type_id) { 'vid' => 'tags', 'name' => $this->randomMachineName(), ]; + case 'block': + // Block placements depend on themes, ensure Bartik is installed. + $this->container->get('theme_installer')->install(['bartik']); + return [ + 'id' => strtolower($this->randomMachineName(8)), + 'plugin' => 'system_powered_by_block', + 'theme' => 'bartik', + 'region' => 'header', + ]; default: if ($this->isConfigEntity($entity_type_id)) { return $this->configEntityValues($entity_type_id); diff --git a/core/modules/system/tests/fixtures/update/drupal-8.update-test-block-disabled-2513534.php b/core/modules/system/tests/fixtures/update/drupal-8.update-test-block-disabled-2513534.php index 0493773..fc8e1c5 100644 --- a/core/modules/system/tests/fixtures/update/drupal-8.update-test-block-disabled-2513534.php +++ b/core/modules/system/tests/fixtures/update/drupal-8.update-test-block-disabled-2513534.php @@ -6,15 +6,16 @@ * upgrade path of https://www.drupal.org/node/2513534. */ +use Drupal\Component\Serialization\Yaml; use Drupal\Core\Database\Database; $connection = Database::getConnection(); // A disabled block. -$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2513534.yml')); +$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testfor2513534.yml')); // A block placed in the default region. -$block_configs[] = \Drupal\Component\Serialization\Yaml::decode(file_get_contents(__DIR__ . '/block.block.secondtestfor2513534.yml')); +$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.secondtestfor2513534.yml')); foreach ($block_configs as $block_config) { $connection->insert('config') diff --git a/core/modules/views/tests/src/Kernel/Handler/AreaOrderTest.php b/core/modules/views/tests/src/Kernel/Handler/AreaOrderTest.php index 3c6ef61..9ade514 100644 --- a/core/modules/views/tests/src/Kernel/Handler/AreaOrderTest.php +++ b/core/modules/views/tests/src/Kernel/Handler/AreaOrderTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\views\Kernel\Handler; -use Drupal\block\Entity\Block; use Drupal\simpletest\BlockCreationTrait; use Drupal\Tests\views\Kernel\ViewsKernelTestBase; use Drupal\views\Views;