public function ImportQueueWorkerLoggingTest::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 ImportQueueWorkerLoggingTest::assertLogMessage()
- ImportQueueWorkerLoggingTest::testImporQueueWorkerLogging in tests/
src/ Kernel/ ImportQueueWorkerLoggingTest.php - Tests logging within import queue worker.
File
- tests/
src/ Kernel/ ImportQueueWorkerLoggingTest.php, line 112
Class
- ImportQueueWorkerLoggingTest
- Tests logging for import queue.
Namespace
Drupal\Tests\acquia_contenthub\KernelCode
public function assertLogMessage(string $type, string $message) {
$count = Database::getConnection()
->select('watchdog', 'w')
->condition('type', $type)
->condition('message', '%' . $message . '%', 'LIKE')
->countQuery()
->execute()
->fetchField();
$this
->assertTrue($count > 0, new FormattableMarkup('watchdog table contains @count rows for @message', [
'@count' => $count,
'@message' => new FormattableMarkup($message, []),
]));
}