.../block/tests/src/Functional/BlockTest.php | 3 ++- .../block_content_test/block_content_test.install | 29 ++++++++++++++++++++++ .../src/Functional/BlockContentCreationTest.php | 8 +++--- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/core/modules/block/tests/src/Functional/BlockTest.php b/core/modules/block/tests/src/Functional/BlockTest.php index bc6fcded6f..60a43bfbbd 100644 --- a/core/modules/block/tests/src/Functional/BlockTest.php +++ b/core/modules/block/tests/src/Functional/BlockTest.php @@ -580,6 +580,7 @@ public function testBlockUserRoleDelete() { $block = Block::create([ 'id' => $this->randomMachineName(), 'plugin' => 'system_powered_by_block', + 'theme' => 'stark', ]); $block->setVisibilityConfig('user_role', [ @@ -615,7 +616,7 @@ public function testBlockTitle() { ]; // Set the block to be shown only to authenticated users. $edit['visibility[user_role][roles][' . RoleInterface::AUTHENTICATED_ID . ']'] = TRUE; - $this->drupalGet('admin/structure/block/add/foo/' . $default_theme); + $this->drupalGet('admin/structure/block/add/system_powered_by_block/' . $default_theme); $this->submitForm($edit, 'Save block'); // Ensure that the title is displayed as plain text. diff --git a/core/modules/block_content/tests/modules/block_content_test/block_content_test.install b/core/modules/block_content/tests/modules/block_content_test/block_content_test.install new file mode 100644 index 0000000000..06d47a9645 --- /dev/null +++ b/core/modules/block_content/tests/modules/block_content_test/block_content_test.install @@ -0,0 +1,29 @@ +isSyncing()) { + // Run before importing config so blocks are created with the correct + // dependencies. + BlockContentType::create([ + 'id' => 'test', + 'label' => 'Test', + ])->save(); + BlockContent::create([ + 'type' => 'test', + // @see config/install/block.block.foobargorilla.yml + 'uuid' => 'fb5e8434-3617-4a1d-a252-8273e95ec30e', + 'info' => 'Something', + ])->save(); + } +} diff --git a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php index bd499aa22b..5d3f7febdf 100644 --- a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php +++ b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php @@ -205,17 +205,19 @@ public function testBlockDelete() { $this->submitForm($edit, 'Save'); // Place the block. + // Note: this is the second block_content entity, the first was created in + // block_content_test_module_preinstall(). $instance = [ 'id' => mb_strtolower($edit['info[0][value]']), 'settings[label]' => $edit['info[0][value]'], 'region' => 'sidebar_first', ]; - $block = BlockContent::load(1); + $block = BlockContent::load(2); $url = 'admin/structure/block/add/block_content:' . $block->uuid() . '/' . $this->config('system.theme')->get('default'); $this->drupalGet($url); $this->submitForm($instance, 'Save block'); - $block = BlockContent::load(1); + $block = BlockContent::load(2); // Test getInstances method. $this->assertCount(1, $block->getInstances()); @@ -225,7 +227,7 @@ public function testBlockDelete() { $this->assertSession()->pageTextContains($body); // Delete the block. - $this->drupalGet('admin/content/block/1/delete'); + $this->drupalGet('admin/content/block/2/delete'); $this->assertSession()->pageTextContains('This will also remove 1 placed block instance.'); $this->submitForm([], 'Delete');