You are here

forena.test in Forena Reports 7.5

Same filename in this branch
  1. 7.5 forena.test
  2. 7.5 tests/forena.test

tests Tests for forena. @author davidmetzler

File

tests/forena.test
View source
<?php

/**
 * @file tests
 * Tests for forena.
 * @author davidmetzler
 *
 */
class ForenaReportTestCase extends DrupalWebTestCase {
  public $privileged_user;
  public static function getInfo() {
    return array(
      'name' => 'Forena Reports',
      'description' => 'Report rendering tests for forena',
      'group' => t('Forena'),
    );
  }
  public function setup() {
    parent::setup(array(
      'forena',
      'forena_test',
    ));

    // Create and log in our privileged user.
    $this->privileged_user = $this
      ->drupalCreateUser(array(
      'access administration pages',
      'access sampledb data',
      'access drupal data',
      'access forena_help data',
      'administer forena reports',
      'list reports',
    ));
    $this
      ->drupalLogin($this->privileged_user);

    // Verify that the cache is loaded.
    $this
      ->drupalGet('forena');
  }

  /**
   * Test Forena Report.
   */
  public function testConfig() {
    $this
      ->drupalGet('reports');
    $this
      ->assertText('Forena Documentation', 'Documentation present.');
    $this
      ->assertText('Sample reports and graphs', 'Sample reports present.');
    $this
      ->assertText('Active Users', 'Drupal admin reports present.');
    $this
      ->drupalGet('reports/sample.states');
    $this
      ->assertText('Simple Table', 'The report title is there.');
    $this
      ->assertText('Alaska', 'A state in the report exists');
  }

  /**
   * Test FRX report Report Syntax.
   */
  public function testRender() {

    // Load the sytnax tests
    $this
      ->drupalGet('reports/test-report');
    $this
      ->assertText('Render Test', 'The report title exists');
    $this
      ->assertText('Not Succeeded', 'Not Positive case.');
    $this
      ->assertNoText('Not Failed', 'Not Negative case.');
    $this
      ->assertText('True Succeeded', 'True positive case.');
    $this
      ->assertNoText('True Failed', 'True negative case');
    $this
      ->assertText('Row Count = 3', 'Row count check.');
    $this
      ->assertText('Row Sum = 6', 'Row Sum check');
    $this
      ->assertText('This is an included report.', 'Included report text is present.');

    // Test an filtered report.
    $this
      ->drupalGet('reports/sample.user_distribution_simple', array(
      'query' => array(
        'state' => 'VA',
      ),
    ));
    $this
      ->assertText('Virginia', 'Found Filtered state.');
    $this
      ->assertText('Amesbury', 'Table detail found.');
  }

}

Classes

Namesort descending Description
ForenaReportTestCase @file tests Tests for forena. @author davidmetzler