protected function XmlSitemapTestBase::assertNoWatchdogErrors in XML sitemap 8
Same name and namespace in other branches
- 2.x tests/src/Functional/XmlSitemapTestBase.php \Drupal\Tests\xmlsitemap\Functional\XmlSitemapTestBase::assertNoWatchdogErrors()
Check that there were no watchdog errors or worse.
1 call to XmlSitemapTestBase::assertNoWatchdogErrors()
- XmlSitemapTestBase::tearDown in tests/
src/ Functional/ XmlSitemapTestBase.php
File
- tests/
src/ Functional/ XmlSitemapTestBase.php, line 447
Class
- XmlSitemapTestBase
- Helper test class with some added functions for testing.
Namespace
Drupal\Tests\xmlsitemap\FunctionalCode
protected function assertNoWatchdogErrors() {
$messages = $this
->getWatchdogMessages();
$verbose = [];
foreach ($messages as $message) {
$message->text = $this
->formatWatchdogMessage($message);
if (in_array($message->severity, [
RfcLogLevel::EMERGENCY,
RfcLogLevel::ALERT,
RfcLogLevel::CRITICAL,
RfcLogLevel::ERROR,
RfcLogLevel::WARNING,
])) {
$this
->fail($message->text);
}
$verbose[] = $message->text;
}
if ($verbose) {
array_unshift($verbose, '<h2>Watchdog messages</h2>');
$this
->verbose(implode('<br />', $verbose), 'Watchdog messages from test run');
}
// Clear the seen watchdog messages since we've failed on any errors.
$this
->getWatchdogMessages([], TRUE);
}