You are here

private function DbLogTest::verifyReports in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/dblog/src/Tests/DbLogTest.php \Drupal\dblog\Tests\DbLogTest::verifyReports()

Confirms that database log reports are displayed at the correct paths.

Parameters

int $response: (optional) HTTP response code. Defaults to 200.

1 call to DbLogTest::verifyReports()
DbLogTest::testDbLog in core/modules/dblog/src/Tests/DbLogTest.php
Tests Database Logging module functionality through interfaces.

File

core/modules/dblog/src/Tests/DbLogTest.php, line 188
Contains \Drupal\dblog\Tests\DbLogTest.

Class

DbLogTest
Generate events and verify dblog entries; verify user access to log reports based on permissions.

Namespace

Drupal\dblog\Tests

Code

private function verifyReports($response = 200) {

  // View the database log help page.
  $this
    ->drupalGet('admin/help/dblog');
  $this
    ->assertResponse($response);
  if ($response == 200) {
    $this
      ->assertText(t('Database Logging'), 'DBLog help was displayed');
  }

  // View the database log report page.
  $this
    ->drupalGet('admin/reports/dblog');
  $this
    ->assertResponse($response);
  if ($response == 200) {
    $this
      ->assertText(t('Recent log messages'), 'DBLog report was displayed');
  }

  // View the database log page-not-found report page.
  $this
    ->drupalGet('admin/reports/page-not-found');
  $this
    ->assertResponse($response);
  if ($response == 200) {
    $this
      ->assertText("Top 'page not found' errors", 'DBLog page-not-found report was displayed');
  }

  // View the database log access-denied report page.
  $this
    ->drupalGet('admin/reports/access-denied');
  $this
    ->assertResponse($response);
  if ($response == 200) {
    $this
      ->assertText("Top 'access denied' errors", 'DBLog access-denied report was displayed');
  }

  // View the database log event page.
  $wid = db_query('SELECT MIN(wid) FROM {watchdog}')
    ->fetchField();
  $this
    ->drupalGet('admin/reports/dblog/event/' . $wid);
  $this
    ->assertResponse($response);
  if ($response == 200) {
    $this
      ->assertText(t('Details'), 'DBLog event node was displayed');
  }
}