Projet

Général

Profil

Paste
Télécharger (1,31 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / views / tests / views_analyze.test @ 4003efde

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
  /**
21
   * {@inheritdoc}
22
   */
23
  public function setUp(array $modules = array()) {
24
    parent::setUp($modules);
25

    
26
    // @todo Figure out why it's required to clear the cache here.
27
    views_module_include('views_default', TRUE);
28
    views_get_all_views(TRUE);
29
    menu_rebuild();
30

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

    
35
  /**
36
   * Tests that analyze works in general.
37
   */
38
  function testAnalyzeBasic() {
39
    $this->drupalLogin($this->admin);
40
    // Enable the frontpage view and click the analyse button.
41
    $view = views_get_view('frontpage');
42
    $view->save();
43

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

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

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

    
55
}