comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\Tests\dblog\Functional;
4
5 use Drupal\filter\Entity\FilterFormat;
6
7 /**
8 * Generate events and verify dblog entries; verify user access to log reports
9 * based on permissions. Using the dblog UI generated by a View.
10 *
11 * @see Drupal\dblog\Tests\DbLogTest
12 *
13 * @group dblog
14 */
15 class DbLogViewsTest extends DbLogTest {
16
17 /**
18 * Modules to enable.
19 *
20 * @var array
21 */
22 public static $modules = ['dblog', 'node', 'forum', 'help', 'block', 'views'];
23
24 /**
25 * {@inheritdoc}
26 */
27 protected function getLogsEntriesTable() {
28 return $this->xpath('.//table[contains(@class, "views-view-table")]/tbody/tr');
29 }
30
31 /**
32 * {@inheritdoc}
33 */
34 protected function filterLogsEntries($type = NULL, $severity = NULL) {
35 $query = [];
36 if (isset($type)) {
37 $query['type[]'] = $type;
38 }
39 if (isset($severity)) {
40 $query['severity[]'] = $severity;
41 }
42
43 $this->drupalGet('admin/reports/dblog', ['query' => $query]);
44 }
45
46 /**
47 * {@inheritdoc}
48 */
49 public function testDBLogAddAndClear() {
50 // Is necesary to create the basic_html format because if absent after
51 // delete the logs, a new log entry is created indicating that basic_html
52 // format do not exists.
53 $basic_html_format = FilterFormat::create([
54 'format' => 'basic_html',
55 'name' => 'Basic HTML',
56 'filters' => [
57 'filter_html' => [
58 'status' => 1,
59 'settings' => [
60 'allowed_html' => '<p> <br> <strong> <a> <em>',
61 ],
62 ],
63 ],
64 ]);
65 $basic_html_format->save();
66
67 parent::testDBLogAddAndClear();
68 }
69
70 }