You are here

public function AnswersViewTestCase::testQuestionsView in Answers 7.3

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

Test Qustions view page.

File

./answers.test, line 280
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(array(
    'administer content types',
    'create question content',
    'edit own question content',
    'create answer content',
    'edit own answer content',
  ));
  $this
    ->drupalLogin($answers_user);
  $this
    ->drupalGet('node/add/question');
  $question = array();
  $question['title'] = 'Woodchucks';
  $question["body[{$langcode}][0][value]"] = "How much wood could a woodchuck chuck?";
  $this
    ->drupalPost('node/add/question', $question, 'Ask Your Question');
  $answer = array();
  $answer["body[{$langcode}][0][value]"] = "Exactly 42 cords of wood.";
  $this
    ->drupalPost('node/add/answer/1', $answer, 'Post Your Answer');
  $this
    ->drupalGet('node/add/question');
  $question = array();
  $question['title'] = 'Is it true?';
  $question["body[{$langcode}][0][value]"] = "Is what they say about Woodchuck true?";
  $this
    ->drupalPost('node/add/question', $question, 'Ask Your Question');
  $this
    ->drupalGet('questions');
  $this
    ->assertLink('Is it true?');
  $this
    ->assertLink('Woodchucks');
}