You are here

public function QuizTakingTestCase::testQuizAvailability in Quiz 7.6

Same name and namespace in other branches
  1. 7.5 tests/QuizTakingTestCase.test \QuizTakingTestCase::testQuizAvailability()

Test the quiz availability tests.

@TODO tests temporarily disabled

File

tests/QuizTakingTestCase.test, line 126

Class

QuizTakingTestCase

Code

public function testQuizAvailability() {

  // Not working on d.o testbots for some reason. Passes locally.
  return;
  $future = REQUEST_TIME + 86400;
  $past = REQUEST_TIME - 86400;

  // Within range.
  $quiz_node = $this
    ->drupalCreateQuiz(array(
    'quiz_always' => 0,
    'quiz_open' => $past,
    'quiz_close' => $future,
  ));
  $this
    ->drupalGet("node/{$quiz_node->nid}");
  $this
    ->assertNoText(t('This @quiz is closed.', array(
    '@quiz' => QUIZ_NAME,
  )));

  // Starts in the future.
  $quiz_node = $this
    ->drupalCreateQuiz(array(
    'quiz_always' => 0,
    'quiz_open' => $future,
    'quiz_close' => $future + 1,
  ));
  $this
    ->drupalGet("node/{$quiz_node->nid}");
  $this
    ->assertText(t('This @quiz is closed.', array(
    '@quiz' => QUIZ_NAME,
  )));

  // Ends in the past.
  $quiz_node = $this
    ->drupalCreateQuiz(array(
    'quiz_always' => 0,
    'quiz_open' => $past,
    'quiz_close' => $past + 1,
  ));
  $this
    ->drupalGet("node/{$quiz_node->nid}");
  $this
    ->assertText(t('This @quiz is closed.', array(
    '@quiz' => QUIZ_NAME,
  )));

  // Always available.
  $quiz_node = $this
    ->drupalCreateQuiz(array(
    'quiz_always' => 1,
    'quiz_open' => $future,
    'quiz_close' => $past,
  ));
  $this
    ->drupalGet("node/{$quiz_node->nid}");
  $this
    ->assertNoText(t('This @quiz is closed.', array(
    '@quiz' => QUIZ_NAME,
  )));
}