summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/views/tests/views_analyze.test
blob: 9bd79221d688d50638d98c652a56b49ace13f458 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php

/**
 * @file
 * Tests the views analyze system.
 */

class ViewsAnalyzeTest extends ViewsSqlTest {
  public static function getInfo() {
    return array(
      'name' => 'Views Analyze',
      'description' => 'Test the views analyze system.',
      'group' => 'Views',
    );
  }

  public function setUp() {
    parent::setUp('views_ui');
    module_enable(array('views_ui'));
    // @TODO Figure out why it's required to clear the cache here.
    views_module_include('views_default', TRUE);
    views_get_all_views(TRUE);
    menu_rebuild();

    // Add an admin user will full rights;
    $this->admin = $this->drupalCreateUser(array('administer views'));
  }

  /**
   * Tests that analyze works in general.
   */
  function testAnalyzeBasic() {
    $this->drupalLogin($this->admin);
    // Enable the frontpage view and click the analyse button.
    $view = views_get_view('frontpage');
    $view->save();

    $this->drupalGet('admin/structure/views/view/frontpage/edit');
    $this->assertLink(t('analyze view'));

    // This redirects the user to the form.
    $this->clickLink(t('analyze view'));
    $this->assertText(t('View analysis'));

    // This redirects the user back to the main views edit page.
    $this->drupalPost(NULL, array(), t('Ok'));
  }
}