diff --git a/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php b/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php index 87728c64ca..01eeb9af4e 100644 --- a/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Block/BlockManagerTest.php @@ -46,6 +46,9 @@ protected function setUp(): void { $this->logger = $this->prophesize(LoggerInterface::class); $this->blockManager = new BlockManager(new \ArrayObject(), $cache_backend->reveal(), $module_handler->reveal(), $this->logger->reveal()); $this->blockManager->setStringTranslation($this->getStringTranslationStub()); + + // Specify the 'broken' block, as well as 3 other blocks with admin labels + // that are purposefully not in alphabetical order. $this->setDefinitions([ 'broken' => [ 'admin_label' => 'Broken/Missing', @@ -79,8 +82,6 @@ protected function setUp(): void { */ protected function setDefinitions(array $definitions) { $discovery = $this->prophesize(DiscoveryInterface::class); - // Specify the 'broken' block, as well as 3 other blocks with admin labels - // that are purposefully not in alphabetical order. $discovery->getDefinitions()->willReturn($definitions); // Force the discovery object onto the block manager. $property = new \ReflectionProperty(BlockManager::class, 'discovery'); @@ -128,6 +129,8 @@ public function testHandlePluginNotFound() { * @expectedDeprecation Declaring ::build() without an array return typehint in Drupal\Tests\Core\Block\TestBlockManagerNoArrayReturnTypeBlock is deprecated in drupal:9.1.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3164649. */ public function testBuildNoReturnType() { + // Overwrite the definitions from ::setUp() to have a block thagt does not + // have a return type for ::build(). $this->setDefinitions([ 'block1' => [ 'provider' => 'test',