You are here

protected function LoggerIntegrationTest::doTestEntry in Service Container 7

Same name and namespace in other branches
  1. 7.2 lib/Drupal/service_container/Tests/LoggerIntegrationTest.php \Drupal\service_container\Tests\LoggerIntegrationTest::doTestEntry()

Checks whether the expected logging entry got written.

Parameters

\Drupal\Core\Database\Connection $connection: The database collection.

1 call to LoggerIntegrationTest::doTestEntry()
LoggerIntegrationTest::testLog in lib/Drupal/service_container/Tests/LoggerIntegrationTest.php

File

lib/Drupal/service_container/Tests/LoggerIntegrationTest.php, line 56
Contains \Drupal\service_container\Tests\LoggerIntegrationTest.

Class

LoggerIntegrationTest

Namespace

Drupal\service_container\Tests

Code

protected function doTestEntry(Connection $connection) {
  $result = $connection
    ->select('watchdog')
    ->fields('watchdog')
    ->execute()
    ->fetchAll();
  $this
    ->assertEqual(1, count($result));
  $this
    ->assertEqual(WATCHDOG_INFO, $result[0]->severity);
  $this
    ->assertEqual('system', $result[0]->type);
  $this
    ->assertEqual('Hello world @key', $result[0]->message);
  $this
    ->assertEqual(array(
    '@key' => 'value',
  ), unserialize($result[0]->variables));
}