home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (views_analyze.test)

This example Drupal source code file (views_analyze.test) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

analysis, analyze, array, description, extends, function, php, public, return, static, system, test, true, views

The views_analyze.test Drupal example source code

// $Id: views_analyze.test,v 2010/11/20 21:40:58 dereine Exp $
 * @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() {
    // @TODO Figure out why it's required to clear the cache here.
    views_module_include('views_default.inc', TRUE);

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

   * Tests that analyse works in general.
  function testAnalyseBasic() {
    // Enable the frontpage view and click the analyse button.
    $view = views_get_view('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'));

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal views_analyze.test source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.