Backup of db before drupal security update
[yaffs-website] / web / core / modules / views_ui / tests / src / Functional / AnalyzeTest.php
1 <?php
2
3 namespace Drupal\Tests\views_ui\Functional;
4
5 /**
6  * Tests the views analyze system.
7  *
8  * @group views_ui
9  */
10 class AnalyzeTest extends UITestBase {
11
12   /**
13    * Modules to enable.
14    *
15    * @var array
16    */
17   public static $modules = ['views_ui'];
18
19   /**
20    * Views used by this test.
21    *
22    * @var array
23    */
24   public static $testViews = ['test_view'];
25
26   /**
27    * Tests that analyze works in general.
28    */
29   public function testAnalyzeBasic() {
30     $this->drupalLogin($this->adminUser);
31
32     $this->drupalGet('admin/structure/views/view/test_view/edit');
33     $this->assertLink(t('Analyze view'));
34
35     // This redirects the user to the analyze form.
36     $this->clickLink(t('Analyze view'));
37     $this->assertSession()->titleEquals('View analysis | Drupal');
38
39     foreach (['ok', 'warning', 'error'] as $type) {
40       $xpath = $this->xpath('//div[contains(@class, :class)]', [':class' => $type]);
41       $this->assertTrue(count($xpath), format_string('Analyse messages with @type found', ['@type' => $type]));
42     }
43
44     // This redirects the user back to the main views edit page.
45     $this->drupalPostForm(NULL, [], t('Ok'));
46   }
47
48 }