function SecurityAdvisoryTest::assertServiceAdvisoryLoggedErrors

Same name and namespace in other branches
  1. 10 core/modules/system/tests/src/Functional/SecurityAdvisories/SecurityAdvisoryTest.php \Drupal\Tests\system\Functional\SecurityAdvisories\SecurityAdvisoryTest::assertServiceAdvisoryLoggedErrors()
  2. 11.x core/modules/system/tests/src/Functional/SecurityAdvisories/SecurityAdvisoryTest.php \Drupal\Tests\system\Functional\SecurityAdvisories\SecurityAdvisoryTest::assertServiceAdvisoryLoggedErrors()

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.

@internal

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 293

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', []);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.