You are here

protected function SecurityAdvisoryTest::assertServiceAdvisoryLoggedErrors in Drupal 9

Asserts the expected error messages were logged on the system logger.

The test module 'advisory_feed_test' must be installed to use this method. The stored error messages are cleared during this method.

Parameters

string[] $expected_messages: The expected error messages.

See also

\Drupal\advisory_feed_test\TestSystemLoggerChannel::log()

1 call to SecurityAdvisoryTest::assertServiceAdvisoryLoggedErrors()
SecurityAdvisoryTest::testPsa in core/modules/system/tests/src/Functional/SecurityAdvisories/SecurityAdvisoryTest.php
Tests that a security advisory is displayed.

File

core/modules/system/tests/src/Functional/SecurityAdvisories/SecurityAdvisoryTest.php, line 285

Class

SecurityAdvisoryTest
Tests of security advisories functionality.

Namespace

Drupal\Tests\system\Functional\SecurityAdvisories

Code

protected function assertServiceAdvisoryLoggedErrors(array $expected_messages) : void {
  $state = $this->container
    ->get('state');
  $messages = $state
    ->get('advisory_feed_test.error_messages', []);
  $this
    ->assertSame($expected_messages, $messages);
  $state
    ->set('advisory_feed_test.error_messages', []);
}