You are here

protected function ConfigSelectorTest::assertMessages in Configuration selector 8.2

Same name and namespace in other branches
  1. 8 tests/src/Kernel/ConfigSelectorTest.php \Drupal\Tests\config_selector\Kernel\ConfigSelectorTest::assertMessages()

Asserts the Drupal message service has messages.

Parameters

array $messages: (optional) The messages we expect the Drupal message service to have. Defaults to an empty array.

string $type: (optional) The type of the expected messages. Defaults to 'status'.

3 calls to ConfigSelectorTest::assertMessages()
ConfigSelectorTest::testConfigSelector in tests/src/Kernel/ConfigSelectorTest.php
Tests \Drupal\config_selector\ConfigSelector().
ConfigSelectorTest::testConfigSelectorIndirectDependency in tests/src/Kernel/ConfigSelectorTest.php
Tests \Drupal\config_selector\ConfigSelector().
ConfigSelectorTest::testConfigSelectorMultipleModuleInstall in tests/src/Kernel/ConfigSelectorTest.php
Tests \Drupal\config_selector\ConfigSelector().

File

tests/src/Kernel/ConfigSelectorTest.php, line 385

Class

ConfigSelectorTest
Tests the ConfigSelector.

Namespace

Drupal\Tests\config_selector\Kernel

Code

protected function assertMessages(array $messages = [], $type = 'status') {
  $actual_messages = \Drupal::messenger()
    ->messagesByType($type);
  if (!empty($actual_messages)) {
    $actual_messages = array_map('strval', $actual_messages);
  }
  $this
    ->assertEquals($messages, $actual_messages);
  \Drupal::messenger()
    ->deleteByType($type);
}