File: /home/iestorre/www2/modules/views/tests/views_analyze.test
<?php
module_load_include('test', 'views', 'tests/views_query');
/**
* @file
* Tests the views analyse 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.inc', TRUE);
views_get_all_views(TRUE);
menu_rebuild();
// Add an admin user will full rights;
$this->admin = $this->drupalCreateUser(array('administer views'));
}
/**
* Tests that analyse works in general.
*/
function testAnalyseBasic() {
$this->drupalLogin($this->admin);
// Enable the frontpage view and click the analyse button.
$view = views_get_view('frontpage');
$view->save();
$this->drupalGet('admin/build/views/edit/frontpage');
$this->helperButtonHasLabel('edit-submit', t('Analyze'));
// This redirects the user to the form.
$this->drupalPost(NULL, array(), t('Analyze'));
$this->assertText(t('View analysis'));
// This redirects the user back to the main views edit page.
$this->drupalPost(NULL, array(), t('Ok'));
}
}