$messages = \Drupal::messenger()->all(); \Drupal::messenger()->deleteAll(); $expected = ['warning' => [newTranslatableMarkup('The block %info was assigned to the invalid region %region and has been disabled.', ['%info' => $block1->id(), '%region' => 'INVALID'])]]; $this->assertEquals($expected, $messages);
// Ensure the region is valid to mirror the behavior of block_rebuild().
// This is done primarily for backwards compatibility support of
// \Drupal\block\BlockInterface::BLOCK_REGION_NONE.
$regions = system_region_list($this->theme); if(!isset($regions[$this->region]) && $this->status()){ $this ->setRegion(system_default_region($this->theme)) ->disable(); } }