You are here

public function AnswersViewTestCase::testQuestionsView in Answers 7.4

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

Test Qustions view page.

File

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

Class

AnswersViewTestCase
Tests the functionality of the answers module views.

Code

public function testQuestionsView() {
  $langcode = LANGUAGE_NONE;
  $answers_user = $this
    ->drupalCreateUser();
  $this
    ->drupalLogin($answers_user);
  $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]"] = "Exactly 42 cords of wood.";
  $this
    ->drupalPost('node/1', $answer, 'Save');
  $this
    ->drupalGet('node/add/answers-question');
  $question = array();
  $question['title'] = 'Is it true?';
  $question["body[{$langcode}][0][value]"] = "Is what they say about Woodchuck true?";
  $this
    ->drupalPost('node/add/answers-question', $question, 'Save');
  $this
    ->drupalGet('questions');
  $this
    ->assertLink('Is it true?');
  $this
    ->assertLink('Woodchucks');
}