You are here

public function LongAnswerUnitTest::unitTestCreateQuestionNode in Quiz 7.4

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

Create and then update a node.

1 call to LongAnswerUnitTest::unitTestCreateQuestionNode()
LongAnswerUnitTest::testNodeAPI in question_types/long_answer/long_answer.test
Run a bundle of Node API tests.

File

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

Class

LongAnswerUnitTest
Unit tests for the long_answer Module. @file

Code

public function unitTestCreateQuestionNode() {
  $node = $this
    ->createLongAnswerQuestion();
  if (!$node) {
    throw new Exception('Expected to have a node to work with.');
  }
  $this->nid1 = $node->nid;
  $this
    ->assertTrue(!empty($node->title), t('check that node title is not empty @title', array(
    '@title' => $node->title,
  )));
  $this
    ->assertTrue(!empty($this->title), t('check that original title is not empty @title', array(
    '@title' => $this->title,
  )));
  $this
    ->assertEqual(strlen($node->title), strlen($this->title), t('check that length of original title and stored title are same.'));
  $this
    ->assertEqual($node->title, $this->title, t('Title of stored node should equal the original title.'));
  $this
    ->assertEqual($node->body, $this->body, t('Body of stored node should be equal to original body.'));
  $this
    ->assertEqual($node->maximum_score, $this->max_score, t('Stored score should be the same as original score.'));
  $this
    ->assertEqual($node->type, $this->question_node_type, t('Stored node type should be long_answer'));
}