Skip to content
Snippets Groups Projects
Commit 49e2b0ea authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2378617 by jhedstrom, dagmar, eosrei, mgifford: Add test for Log Details links

parent b5969b69
No related branches found
No related tags found
No related merge requests found
......@@ -83,6 +83,39 @@ function testDbLog() {
$this->verifyReports(403);
}
/**
* Test individual log event page.
*/
public function testLogEventPage() {
// Login the admin user.
$this->drupalLogin($this->adminUser);
// Since referrer and location links vary by how the tests are run, inject
// fake log data to test these.
$context = [
'request_uri' => 'http://example.com?dblog=1',
'referer' => 'http://example.org?dblog=2',
'uid' => 0,
'channel' => 'testing',
'link' => 'foo/bar',
'ip' => '0.0.1.0',
'timestamp' => REQUEST_TIME,
];
\Drupal::service('logger.dblog')->log(RfcLogLevel::NOTICE, 'Test message', $context);
$wid = db_query('SELECT MAX(wid) FROM {watchdog}')->fetchField();
// Verify the links appear correctly.
$this->drupalGet('admin/reports/dblog/event/' . $wid);
$this->assertLinkByHref($context['request_uri']);
$this->assertLinkByHref($context['referer']);
// Verify hostname.
$this->assertRaw($context['ip'], 'Found hostname on the detail page.');
// Verify severity.
$this->assertText('Notice', 'The severity was properly displayed on the detail page.');
}
/**
* Verifies setting of the database log row limit.
*
......@@ -229,7 +262,6 @@ private function verifyReports($response = 200) {
if ($response == 200) {
$this->assertText(t('Details'), 'DBLog event node was displayed');
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment