You are here

public function AnswersBestViewTestCase::testQuestionsView in Answers 7.4

Test Qustions view page.

File

answers_best_answer/answers_best_answer.test, line 242
Tests for answers_best_answer.module.

Class

AnswersBestViewTestCase
Tests the functionality of the answers_userpoints module admin settings.

Code

public function testQuestionsView() {
  $langcode = LANGUAGE_NONE;
  $this
    ->drupalLogin($this->answersUser);
  $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
    ->clickLink('Best');
  $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');
  $answer = array();
  $answer["body[{$langcode}][0][value]"] = "Woodchuck do not chuck wood. If that is what they say, then yes it is true.";
  $this
    ->drupalPost('node/3', $answer, 'Save');
  $this
    ->drupalGet('questions');
  $this
    ->assertLink('Is it true?');
  $this
    ->assertLink('Woodchucks');
  $this
    ->drupalGet('questions/unanswered');
  $this
    ->assertLink('Is it true?');
  $this
    ->assertNoText('Woodchucks');
  $this
    ->drupalGet('questions/answered');
  $this
    ->assertNoText('Is it true?');
  $this
    ->assertLink('Woodchucks');
  $this
    ->drupalGet('questions/all');
  $this
    ->assertLink('Is it true?');
  $this
    ->assertLink('Woodchucks');
}