You are here

public function LongAnswerUnitTest::createLongAnswerQuestion in Quiz 7.4

Same name and namespace in other branches
  1. 6.6 question_types/long_answer/long_answer.test \LongAnswerUnitTest::createLongAnswerQuestion()
  2. 6.3 question_types/long_answer/long_answer.test \LongAnswerUnitTest::createLongAnswerQuestion()
  3. 6.4 question_types/long_answer/long_answer.test \LongAnswerUnitTest::createLongAnswerQuestion()
  4. 6.5 question_types/long_answer/long_answer.test \LongAnswerUnitTest::createLongAnswerQuestion()
  5. 7 question_types/long_answer/long_answer.test \LongAnswerUnitTest::createLongAnswerQuestion()

Utility function for creating a new test question.

1 call to LongAnswerUnitTest::createLongAnswerQuestion()
LongAnswerUnitTest::unitTestCreateQuestionNode in question_types/long_answer/long_answer.test
Create and then update a node.

File

question_types/long_answer/long_answer.test, line 94
Unit tests for the long_answer Module.

Class

LongAnswerUnitTest
Unit tests for the long_answer Module. @file

Code

public function createLongAnswerQuestion() {
  $this->title = $this
    ->randomName($this
    ->getRandSize());
  $this->body = $this
    ->randomName($this
    ->getRandSize());
  $this->max_score = $this
    ->getRandSize();

  // array of node attributes
  $settings = array(
    'type' => $this->question_node_type,
    'title' => $this->title,
    'body' => $this->body,
    'maximum_score' => $this->max_score,
    'revisions' => TRUE,
  );

  // create test drupal node
  return $this
    ->drupalCreateNode($settings);
}