diff -u b/core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php b/core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php --- b/core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php +++ b/core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\block\Functional; use Drupal\block\Entity\Block; +use Drupal\Component\Render\FormattableMarkup; /** * Provides test assertions for testing block appearance. @@ -19,7 +20,7 @@ */ protected function assertBlockAppears(Block $block) { $result = $this->findBlockInstance($block); - $this->assertTrue(!empty($result), format_string('Ensure the block @id appears on the page', ['@id' => $block->id()])); + $this->assertTrue(!empty($result), new FormattableMarkup('Ensure the block @id appears on the page', ['@id' => $block->id()])); } /** @@ -30,7 +31,7 @@ */ protected function assertNoBlockAppears(Block $block) { $result = $this->findBlockInstance($block); - $this->assertFalse(!empty($result), format_string('Ensure the block @id does not appear on the page', ['@id' => $block->id()])); + $this->assertFalse(!empty($result), new FormattableMarkup('Ensure the block @id does not appear on the page', ['@id' => $block->id()])); } /** @@ -49 +50 @@ -} \ No newline at end of file +} diff -u b/core/modules/block/tests/src/Functional/BlockTest.php b/core/modules/block/tests/src/Functional/BlockTest.php --- b/core/modules/block/tests/src/Functional/BlockTest.php +++ b/core/modules/block/tests/src/Functional/BlockTest.php @@ -261,7 +261,7 @@ $theme_settings->set('default', $theme)->save(); $this->drupalGet(''); $elements = $this->xpath('//div[@id = :id]', [':id' => Html::getUniqueId('block-' . $block['id'])]); - $this->assertNotEmpty($elements, 'The block was found.'); + $this->assertTrue(!empty($elements), 'The block was found.'); } } diff -u b/core/modules/block/tests/src/Functional/BlockTestBase.php b/core/modules/block/src/Tests/BlockTestBase.php --- b/core/modules/block/tests/src/Functional/BlockTestBase.php +++ b/core/modules/block/src/Tests/BlockTestBase.php @@ -1,14 +1,21 @@ drupalGet('admin/structure/block'); // Look for the blocks table. $blocks_table = $this->xpath("//table[@id='blocks']"); - $this->assertNotEmpty($blocks_table, 'The blocks table is being rendered.'); + $this->assertTrue(!empty($blocks_table), 'The blocks table is being rendered.'); // Look for test blocks in the table. foreach ($this->blockValues as $delta => $values) { $block = $this->blocks[$delta]; @@ -134,7 +134,7 @@ $this->drupalPlaceBlock('system_powered_by_block', ['region' => 'header', 'id' => 'header']); $this->drupalGet('admin/structure/block'); $element = $this->xpath('//tr[contains(@class, :class)]', [':class' => 'region-title-header']); - $this->assertNotEmpty($element); + $this->assertTrue(!empty($element)); // Ensure hidden themes do not appear in the UI. Enable another non base // theme and place the local tasks block. @@ -173,7 +173,7 @@ $this->drupalGet('admin/structure/block'); $this->clickLink('Place block'); $elements = $this->xpath($pattern, $arguments); - $this->assertNotEmpty($elements, 'The test block appears in the category for its module.'); + $this->assertTrue(!empty($elements), 'The test block appears in the category for its module.'); // Trigger the custom category addition in block_test_block_alter(). $this->container->get('state')->set('block_test_info_alter', TRUE); @@ -183,7 +183,7 @@ $this->clickLink('Place block'); $arguments[':category'] = 'Custom category'; $elements = $this->xpath($pattern, $arguments); - $this->assertNotEmpty($elements, 'The test block appears in a custom category controlled by block_test_block_alter().'); + $this->assertTrue(!empty($elements), 'The test block appears in a custom category controlled by block_test_block_alter().'); } /** @@ -199,10 +199,10 @@ $this->drupalGet('admin/structure/block'); $this->clickLink('Place block'); $elements = $this->xpath('//tr[.//td/div[text()=:text] and .//td[text()=:category] and .//td//a[contains(@href, :href)]]', $arguments); - $this->assertEmpty($elements, 'The context-aware test block does not appear.'); + $this->assertTrue(empty($elements), 'The context-aware test block does not appear.'); $definition = \Drupal::service('plugin.manager.block')->getDefinition('test_context_aware_unsatisfied'); - $this->assertNotEmpty($definition, 'The context-aware test block does not exist.'); + $this->assertTrue(!empty($definition), 'The context-aware test block does not exist.'); } /** @@ -225,9 +225,9 @@ $this->drupalGet('admin/structure/block'); $this->clickLink('Place block'); $elements = $this->xpath($pattern, $arguments); - $this->assertNotEmpty($elements, 'The context-aware test block appears.'); + $this->assertTrue(!empty($elements), 'The context-aware test block appears.'); $definition = \Drupal::service('plugin.manager.block')->getDefinition('test_context_aware'); - $this->assertNotEmpty($definition, 'The context-aware test block exists.'); + $this->assertTrue(!empty($definition), 'The context-aware test block exists.'); $edit = [ 'region' => 'content', 'settings[context_mapping][user]' => '@block_test.multiple_static_context:userB',