core/modules/block/src/Tests/BlockViewBuilderTest.php | 10 ++++++---- core/modules/block/tests/modules/block_test/block_test.module | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/modules/block/src/Tests/BlockViewBuilderTest.php b/core/modules/block/src/Tests/BlockViewBuilderTest.php index 51e87ad..bd35f1d 100644 --- a/core/modules/block/src/Tests/BlockViewBuilderTest.php +++ b/core/modules/block/src/Tests/BlockViewBuilderTest.php @@ -269,10 +269,12 @@ public function testBlockViewBuilderBuildAlter() { \Drupal::state()->set('block_test_block_alter_cache_max_age', NULL); // hook_block_build_alter() sets #create_placeholder. - \Drupal::state()->set('block_test_block_alter_create_placeholder', TRUE); - $build = $this->getBlockRenderArray(); - $this->assertTrue(isset($build['#create_placeholder'])); - $this->assertTrue($build['#create_placeholder']); + foreach ([TRUE, FALSE] as $value) { + \Drupal::state()->set('block_test_block_alter_create_placeholder', $value); + $build = $this->getBlockRenderArray(); + $this->assertTrue(isset($build['#create_placeholder'])); + $this->assertIdentical($value, $build['#create_placeholder']); + } \Drupal::state()->set('block_test_block_alter_create_placeholder', NULL); // Restore the previous request method. diff --git a/core/modules/block/tests/modules/block_test/block_test.module b/core/modules/block/tests/modules/block_test/block_test.module index 284b836..74ea34c 100644 --- a/core/modules/block/tests/modules/block_test/block_test.module +++ b/core/modules/block/tests/modules/block_test/block_test.module @@ -49,7 +49,7 @@ function block_test_block_build_test_cache_alter(array &$build, BlockPluginInter // Test setting #create_placeholder. if (\Drupal::state()->get('block_test_block_alter_create_placeholder') !== NULL) { - $build['#create_placeholder'] = TRUE; + $build['#create_placeholder'] = \Drupal::state()->get('block_test_block_alter_create_placeholder'); } }