diff --git a/src/Tests/PanelizerEnableTest.php b/src/Tests/PanelizerEnableTest.php index bc87e2b..79dc0f1 100644 --- a/src/Tests/PanelizerEnableTest.php +++ b/src/Tests/PanelizerEnableTest.php @@ -25,12 +25,12 @@ class PanelizerEnableTest extends WebTestBase { */ public static $modules = [ 'block', - 'block_content', 'ctools', 'ctools_block', 'layout_plugin', 'node', 'panelizer', + 'panelizer_test', 'panels', 'panels_ipe', ]; @@ -62,24 +62,19 @@ class PanelizerEnableTest extends WebTestBase { * Tests that Panels IPE is enabled for a node of a Panelizer-enabled type. */ public function testPanelizerEnabled() { - // Add a block to the panelized layout. - $block = BlockContent::create([ - 'type' => 'basic', - 'body' => 'This is my utterly exciting custom block.', - ]); - \Drupal::service('plugin.manager.block')->clearCachedDefinitions(); /** @var \Drupal\panelizer\PanelizerInterface $panelizer */ $panelizer = \Drupal::service('panelizer'); $displays = $panelizer->getDefaultPanelsDisplays('node', 'page', 'default'); $display = $displays['default']; $display->addBlock([ - 'id' => 'block_content:' . $block->uuid(), - 'label' => 'Custom Block', + 'id' => 'panelizer_test', + 'label' => 'Panelizer test', 'provider' => 'block_content', 'region' => 'middle', ]); $panelizer->setDefaultPanelsDisplay('default', 'node', 'page', 'default', $display); + // Create a node, and check that the IPE is visible on it. $node = $this->drupalCreateNode(['type' => 'page']); $out = $this->drupalGet('node/' . $node->id()); $this->verbose($out); @@ -90,12 +85,10 @@ class PanelizerEnableTest extends WebTestBase { else { $this->fail('Could not parse page content.'); } - $this->assertText('Custom Block'); - // For whatever reason, this assertion is persistently failing. If you check - // the verbose output of $this->drupalGet(), you'll see that the block is - // in the Panels display, but considered broken by the block system. - // Happy debugging! - phenaproxima - $this->assertText($block->body->value); + + // Check that the block we added is visible. + $this->assertText('Panelizer test'); + $this->assertText('Abracadabra'); } } diff --git a/tests/modules/panelizer_test/panelizer_test.info.yml b/tests/modules/panelizer_test/panelizer_test.info.yml new file mode 100644 index 0000000..6c195d9 --- /dev/null +++ b/tests/modules/panelizer_test/panelizer_test.info.yml @@ -0,0 +1,4 @@ +type: module +name: Panelizer Test +description: 'Required for Panelizer simpletests only.' +core: 8.x diff --git a/tests/modules/panelizer_test/src/Plugin/Block/PanelizerTestBlock.php b/tests/modules/panelizer_test/src/Plugin/Block/PanelizerTestBlock.php new file mode 100644 index 0000000..0a596fc --- /dev/null +++ b/tests/modules/panelizer_test/src/Plugin/Block/PanelizerTestBlock.php @@ -0,0 +1,31 @@ + 'Abracadabra', + ]; + } + +} \ No newline at end of file