You are here

public function AnswersTestCase::testAnswerWithNoBody in Answers 7.4

Same name and namespace in other branches
  1. 7.3 answers.test \AnswersTestCase::testAnswerWithNoBody()

Tests body is required on answers_answer.

File

./answers.test, line 176
Tests for answers.module.

Class

AnswersTestCase
Tests the functionality of the answers module.

Code

public function testAnswerWithNoBody() {
  $langcode = LANGUAGE_NONE;
  $user2 = $this
    ->drupalCreateUser();
  $this
    ->drupalLogin($user2);
  $this
    ->drupalGet('node/add/answers-question');
  $question = array();
  $question['title'] = 'Woodchucks';
  $question["body[{$langcode}][0][value]"] = "How much wood could a woodchuck chuck?";
  $this
    ->drupalPost('node/add/answers-question', $question, 'Save');
  $answer = array();
  $answer["body[{$langcode}][0][value]"] = "";
  $this
    ->drupalPost('node/1', $answer, 'Save');
  $this
    ->assertRaw('<textarea class="text-full form-textarea required error" id="edit-body-und-0-value" name="body[und][0][value]" cols="60" rows="15"></textarea>', 'Body field is required');
}