Mercurial > hg > isophonics-drupal-site
diff core/modules/dblog/tests/src/Functional/DbLogViewsTest.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 129ea1e6d783 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/core/modules/dblog/tests/src/Functional/DbLogViewsTest.php Wed Nov 29 16:09:58 2017 +0000 @@ -0,0 +1,70 @@ +<?php + +namespace Drupal\Tests\dblog\Functional; + +use Drupal\filter\Entity\FilterFormat; + +/** + * Generate events and verify dblog entries; verify user access to log reports + * based on permissions. Using the dblog UI generated by a View. + * + * @see Drupal\dblog\Tests\DbLogTest + * + * @group dblog + */ +class DbLogViewsTest extends DbLogTest { + + /** + * Modules to enable. + * + * @var array + */ + public static $modules = ['dblog', 'node', 'forum', 'help', 'block', 'views']; + + /** + * {@inheritdoc} + */ + protected function getLogsEntriesTable() { + return $this->xpath('.//table[contains(@class, "views-view-table")]/tbody/tr'); + } + + /** + * {@inheritdoc} + */ + protected function filterLogsEntries($type = NULL, $severity = NULL) { + $query = []; + if (isset($type)) { + $query['type[]'] = $type; + } + if (isset($severity)) { + $query['severity[]'] = $severity; + } + + $this->drupalGet('admin/reports/dblog', ['query' => $query]); + } + + /** + * {@inheritdoc} + */ + public function testDBLogAddAndClear() { + // Is necesary to create the basic_html format because if absent after + // delete the logs, a new log entry is created indicating that basic_html + // format do not exists. + $basic_html_format = FilterFormat::create([ + 'format' => 'basic_html', + 'name' => 'Basic HTML', + 'filters' => [ + 'filter_html' => [ + 'status' => 1, + 'settings' => [ + 'allowed_html' => '<p> <br> <strong> <a> <em>', + ], + ], + ], + ]); + $basic_html_format->save(); + + parent::testDBLogAddAndClear(); + } + +}