views_analyze.test

Definition of ViewsAnalyzeTest.

File

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