public function WatchdogAssertsTrait::assertLogMessage in Acquia Content Hub 8.2
Verify a log entry was entered into watchdog table.
Parameters
string $type: The channel to which this message belongs.
string $message: The message to check in the log.
1 call to WatchdogAssertsTrait::assertLogMessage()
- ContentHubFilterExecuteWorkerTest::testProcessItemLogginMsgWithEmptyWebhookUuuid in tests/
src/ Kernel/ ContentHubFilterExecuteWorkerTest.php - @covers ::processItem
File
- tests/
src/ Kernel/ Traits/ WatchdogAssertsTrait.php, line 20
Class
- WatchdogAssertsTrait
- Contains dblog related asserts.
Namespace
Drupal\Tests\acquia_contenthub\Kernel\TraitsCode
public function assertLogMessage(string $type, string $message) {
$count = \Drupal::database()
->select('watchdog', 'w')
->condition('type', $type)
->condition('message', '%' . $message . '%', 'LIKE')
->countQuery()
->execute()
->fetchField();
$this
->assertTrue($count > 0, sprintf('watchdog table contains %s rows for %s', $count, $message));
}