Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / dblog / tests / src / Functional / DbLogViewsTest.php
1 <?php
2
3 namespace Drupal\Tests\dblog\Functional;
4
5 use Drupal\views\Views;
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    * Tests the empty text for the watchdog view is not using an input format.
48    */
49   public function testEmptyText() {
50     $view = Views::getView('watchdog');
51     $data = $view->storage->toArray();
52     $area = $data['display']['default']['display_options']['empty']['area'];
53
54     $this->assertEqual('text_custom', $area['plugin_id']);
55     $this->assertEqual('area_text_custom', $area['field']);
56     $this->assertEqual('No log messages available.', $area['content']);
57   }
58
59 }