Commit | Line | Data |
---|---|---|
7f254ad8 AE |
1 | <?php |
2 | ||
3 | /** | |
4 | * @file | |
5 | * Definition of ViewsAnalyzeTest. | |
6 | */ | |
7 | ||
8 | /** | |
9 | * Tests the views analyze system. | |
10 | */ | |
11 | class ViewsAnalyzeTest extends ViewsSqlTest { | |
12 | public static function getInfo() { | |
13 | return array( | |
14 | 'name' => 'Views Analyze', | |
15 | 'description' => 'Test the views analyze system.', | |
16 | 'group' => 'Views', | |
17 | ); | |
18 | } | |
19 | ||
20 | public function setUp() { | |
21 | parent::setUp('views_ui'); | |
22 | module_enable(array('views_ui')); | |
23 | // @TODO Figure out why it's required to clear the cache here. | |
24 | views_module_include('views_default', TRUE); | |
25 | views_get_all_views(TRUE); | |
26 | menu_rebuild(); | |
27 | ||
28 | // Add an admin user will full rights; | |
29 | $this->admin = $this->drupalCreateUser(array('administer views')); | |
30 | } | |
31 | ||
32 | /** | |
33 | * Tests that analyze works in general. | |
34 | */ | |
35 | function testAnalyzeBasic() { | |
36 | $this->drupalLogin($this->admin); | |
37 | // Enable the frontpage view and click the analyse button. | |
38 | $view = views_get_view('frontpage'); | |
39 | $view->save(); | |
40 | ||
41 | $this->drupalGet('admin/structure/views/view/frontpage/edit'); | |
42 | $this->assertLink(t('analyze view')); | |
43 | ||
44 | // This redirects the user to the form. | |
45 | $this->clickLink(t('analyze view')); | |
46 | $this->assertText(t('View analysis')); | |
47 | ||
48 | // This redirects the user back to the main views edit page. | |
49 | $this->drupalPost(NULL, array(), t('Ok')); | |
50 | } | |
51 | } |