From 2403b4a5dfbf723b52952ac7dde695ca10187640 Mon Sep 17 00:00:00 2001 From: Siju Mathew <65250-sijumpk@users.noreply.drupalcode.org> Date: Sat, 27 Jan 2024 07:20:45 +0000 Subject: [PATCH] Adding failing test for disabled block appearing in blocks list --- .../src/Functional/Plugin/DisabledDisplayTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/modules/views/tests/src/Functional/Plugin/DisabledDisplayTest.php b/core/modules/views/tests/src/Functional/Plugin/DisabledDisplayTest.php index 54548cb95625..6c09b44297bc 100644 --- a/core/modules/views/tests/src/Functional/Plugin/DisabledDisplayTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/DisabledDisplayTest.php @@ -42,6 +42,7 @@ protected function setUp($import_test_views = TRUE, $modules = ['views_test_conf $this->drupalPlaceBlock('page_title_block'); $admin_user = $this->drupalCreateUser([ + 'administer blocks', 'administer site configuration', ]); $this->drupalLogin($admin_user); @@ -87,6 +88,11 @@ public function testDisabledDisplays() { $this->drupalGet('test-disabled-display-2'); $this->assertSession()->elementTextEquals('xpath', '//h1[@class="page-title"]', 'test_disabled_display'); + // Confirm that the block is available in the block administration UI. + $this->drupalGet('admin/structure/block/list/' . $this->config('system.theme')->get('default')); + $this->clickLink('Place block'); + $this->assertSession()->pageTextContains('test_disabled_display'); + // Disable each disabled display and save the view. foreach ($display_ids as $display_id) { $view->getExecutable()->displayHandlers->get($display_id)->setOption('enabled', FALSE); @@ -104,6 +110,11 @@ public function testDisabledDisplays() { // Check that the page_2 display is now disabled again. $this->drupalGet('test-disabled-display-2'); $this->assertSession()->statusCodeEquals(404); + + // Confirm that the block is not available in the block administration UI. + $this->drupalGet('admin/structure/block/list/' . $this->config('system.theme')->get('default')); + $this->clickLink('Place block'); + $this->assertSession()->pageTextNotContains('test_disabled_display'); } } -- GitLab