WatchdogAssertsTrait.php in Acquia Content Hub 8.2
File
tests/src/Kernel/Traits/WatchdogAssertsTrait.php
View source
<?php
namespace Drupal\Tests\acquia_contenthub\Kernel\Traits;
trait WatchdogAssertsTrait {
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));
}
}