X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fviews_ui%2Fsrc%2FTests%2FAnalyzeTest.php;fp=web%2Fcore%2Fmodules%2Fviews_ui%2Fsrc%2FTests%2FAnalyzeTest.php;h=83e25313d67c1219d85280dd2ca2404e01018876;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/web/core/modules/views_ui/src/Tests/AnalyzeTest.php b/web/core/modules/views_ui/src/Tests/AnalyzeTest.php new file mode 100644 index 000000000..83e25313d --- /dev/null +++ b/web/core/modules/views_ui/src/Tests/AnalyzeTest.php @@ -0,0 +1,59 @@ +enableViewsTestModule(); + + // Add an admin user will full rights; + $this->admin = $this->drupalCreateUser(['administer views']); + } + + /** + * Tests that analyze works in general. + */ + public function testAnalyzeBasic() { + $this->drupalLogin($this->admin); + + $this->drupalGet('admin/structure/views/view/test_view/edit'); + $this->assertLink(t('Analyze view')); + + // This redirects the user to the analyze form. + $this->clickLink(t('Analyze view')); + $this->assertText(t('View analysis')); + + foreach (['ok', 'warning', 'error'] as $type) { + $xpath = $this->xpath('//div[contains(@class, :class)]', [':class' => $type]); + $this->assertTrue(count($xpath), format_string('Analyse messages with @type found', ['@type' => $type])); + } + + // This redirects the user back to the main views edit page. + $this->drupalPostForm(NULL, [], t('Ok')); + } + +}