You are here

public function ShortAnswerTestCase::testCreateQuizQuestion in Quiz 8.5

Same name and namespace in other branches
  1. 8.6 question_types/quiz_short_answer/tests/src/Functional/ShortAnswerTestCase.php \Drupal\Tests\quiz_short_answer\Functional\ShortAnswerTestCase::testCreateQuizQuestion()
  2. 6.x question_types/quiz_short_answer/tests/src/Functional/ShortAnswerTestCase.php \Drupal\Tests\quiz_short_answer\Functional\ShortAnswerTestCase::testCreateQuizQuestion()

Test creating a short answer question.

File

question_types/quiz_short_answer/tests/src/Functional/ShortAnswerTestCase.php, line 27
Unit tests for the short_answer Module.

Class

ShortAnswerTestCase
Test class for short answer.

Namespace

Drupal\Tests\quiz_short_answer\Functional

Code

public function testCreateQuizQuestion($settings = array()) {
  $question = QuizQuestion::create($settings + array(
    'type' => 'short_answer',
    'title' => 'SA 1 title',
    'body' => 'SA 1 body text.',
  ));
  $question
    ->save();
  return $question;
}