You are here

QuizQuestionTestCase.test in Quiz 7.6

Same filename and directory in other branches
  1. 7.5 question_types/quiz_question/QuizQuestionTestCase.test

Unit tests for the quiz question Module.

File

question_types/quiz_question/QuizQuestionTestCase.test
View source
<?php

/**
 * @file
 * Unit tests for the quiz question Module.
 */

/**
 * Base test class for Quiz questions.
 */
abstract class QuizQuestionTestCase extends QuizTestCase {
  var $question_node_type = 'quiz_question';

  /**
   * Set up a question test case.
   *
   * @param array $modules
   *   Array of modules to enable.
   * @param array $admin_permissions
   *   Array of admin permissions to add.
   * @param array $user_permissions
   *   Array of user permissions to add.
   */
  function setUp($modules = array(), $admin_permissions = array(), $user_permissions = array()) {
    $modules[] = 'quiz_question';
    $admin_permissions[] = "create {$this->question_node_type} content";
    $admin_permissions[] = "edit any {$this->question_node_type} content";
    $user_permissions[] = 'access quiz';
    parent::setUp($modules, $admin_permissions, $user_permissions);
  }

  /**
   * Test the subclass's quiz question implementation.
   */
  public function testQuizQuestionImplementation() {
    $qq = quiz_question_get_info();
    $this
      ->assertTrue(isset($qq[$this->question_node_type]), t('Check that the question implementation is correct.'));
  }

  /**
   * Every question test should implement a test for creation of its own
   * question.
   */
  public abstract function testCreateQuizQuestion();

}

Classes

Namesort descending Description
QuizQuestionTestCase Base test class for Quiz questions.