You are here

protected function ApigeeEdgeActionsRulesKernelTestBase::assertLogsContains in Apigee Edge 8

Helper to assert logs.

Parameters

string $message: The message to assert in the logs.

string $type: The type for the log.

8 calls to ApigeeEdgeActionsRulesKernelTestBase::assertLogsContains()
EdgeEntityAddMemberEventTest::testEvent in modules/apigee_edge_actions/tests/src/Kernel/Plugin/RulesEvent/EdgeEntityAddMemberEventTest.php
Tests add_member events for Edge entities.
EdgeEntityAddProductEventTest::testEvent in modules/apigee_edge_actions/tests/src/Kernel/Plugin/RulesEvent/EdgeEntityAddProductEventTest.php
Tests add_member events for Edge entities.
EdgeEntityDeleteEventTest::testEvent in modules/apigee_edge_actions/tests/src/Kernel/Plugin/RulesEvent/EdgeEntityDeleteEventTest.php
Tests delete events for Edge entities.
EdgeEntityInsertEventTest::testEvent in modules/apigee_edge_actions/tests/src/Kernel/Plugin/RulesEvent/EdgeEntityInsertEventTest.php
Tests insert events for Edge entities.
EdgeEntityRemoveMemberEventTest::testEvent in modules/apigee_edge_actions/tests/src/Kernel/Plugin/RulesEvent/EdgeEntityRemoveMemberEventTest.php
Tests add_member events for Edge entities.

... See full list

File

modules/apigee_edge_actions/tests/src/Kernel/ApigeeEdgeActionsRulesKernelTestBase.php, line 101

Class

ApigeeEdgeActionsRulesKernelTestBase
Provides a base class for testing Edge entity events.

Namespace

Drupal\Tests\apigee_edge_actions\Kernel

Code

protected function assertLogsContains(string $message, $type = 'apigee_edge_actions') {
  $logs = Database::getConnection()
    ->select('watchdog', 'wd')
    ->fields('wd', [
    'message',
    'variables',
  ])
    ->condition('type', $type)
    ->execute()
    ->fetchAll();
  $controller = DbLogController::create($this->container);
  $messages = array_map(function ($log) use ($controller) {
    return (string) $controller
      ->formatMessage($log);
  }, $logs);
  $this
    ->assertContains($message, $messages);
}