Chris@0: findBlockInstance($block); Chris@0: $this->assertTrue(!empty($result), new FormattableMarkup('The block @id appears on the page', ['@id' => $block->id()])); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Checks to see whether a block does not appears on the page. Chris@0: * Chris@0: * @param \Drupal\block\Entity\Block $block Chris@0: * The block entity to find on the page. Chris@0: */ Chris@0: protected function assertNoBlockAppears(Block $block) { Chris@0: $result = $this->findBlockInstance($block); Chris@0: $this->assertFalse(!empty($result), new FormattableMarkup('The block @id does not appear on the page', ['@id' => $block->id()])); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Find a block instance on the page. Chris@0: * Chris@0: * @param \Drupal\block\Entity\Block $block Chris@0: * The block entity to find on the page. Chris@0: * Chris@0: * @return array Chris@0: * The result from the xpath query. Chris@0: */ Chris@0: protected function findBlockInstance(Block $block) { Chris@0: return $this->xpath('//div[@id = :id]', [':id' => 'block-' . $block->id()]); Chris@0: } Chris@0: Chris@0: }