You are here

vns.test in Views Nivo Slider 7.3

SimpleTest tests for views_nivo_slider.module.

File

tests/vns.test
View source
<?php

/**
 * @file
 * SimpleTest tests for views_nivo_slider.module.
 */

// wrapper test for views_nivo_slider module
class testViewsNivoSliderFormsTestCase extends DrupalWebTestCase {
  protected $privileged_user;
  public static function getInfo() {
    return array(
      'name' => 'Views Nivo Slider',
      'description' => 'Views Nivo Slider WebTesting.',
      'group' => 'Views Nivo Slider',
    );
  }
  public function setUp() {

    // Enable any modules required for test
    parent::setUp('views_ui', 'views_nivo_slider_test', 'ctools', 'libraries');
    drupal_load('module', 'views_ui');
    drupal_load('module', 'views_nivo_slider_test');
    drupal_load('module', 'ctools');
    drupal_load('module', 'libraries');

    // Create and log in our user. The user has the arbitrary privilege
    // 'administer site configuration' which the code uses
    // to grant access.
    $this->privileged_user = $this
      ->drupalCreateUser(array_keys(module_invoke_all('permission')));
    $this
      ->drupalLogin($this->privileged_user);
  }

  // views_nivo_slider views forms test initial wrapper
  public function testViewsNivoSliderForms() {
    $edit = array();
    $this
      ->drupalPost('/admin/structure/views/nojs/display/nivo_test/page/style_plugin', $edit, t('Apply'));
    $this
      ->assertRaw('Views', 'Views Nivo Slider');
    $this
      ->drupalPost('/admin/structure/views/nojs/display/nivo_test/page/style_options', $edit, t('Apply'));
    $this
      ->assertRaw('Views', 'Views Nivo Slider');
    $this
      ->drupalPost('/admin/structure/views/nojs/display/nivo_test/page/row_plugin', $edit, t('Apply'));
    $this
      ->assertRaw('Views', 'Views Nivo Slider');
    $this
      ->drupalPost('/admin/structure/views/nojs/display/nivo_test/page/row_options', $edit, t('Apply'));
    $this
      ->assertRaw('Views', 'Views Nivo Slider');
  }

  // views_nivo_slider page test initial wrapper
  public function testViewsNivoSliderPage() {
    $content_type = $this
      ->drupalCreateContentType();
    $content_node1 = $this
      ->drupalCreateNode();
    $content_node2 = $this
      ->drupalCreateNode();
    $content_node3 = $this
      ->drupalCreateNode();
    $edit2 = array();
    $this
      ->drupalGet('/nivo-test', $edit2);
  }

  /**
   * Detect if we're running on PIFR testbot; skip intentional failure in that
   * case. It happens that on the testbot the site under test is in a directory
   * named 'checkout' or 'site_under_test'.
   *
   * @return boolean
   *   TRUE if running on testbot.
   */
  public function runningOnTestbot() {
    return file_exists("../checkout") || file_exists("../site_under_test");
  }

}