You are here

public function AnswersBestTestCase::testDeleteBestAnswer in Answers 7.4

Test deleting best answer.

File

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

Class

AnswersBestTestCase
Tests the functionality of the answers_userpoints module admin settings.

Code

public function testDeleteBestAnswer() {
  $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');
  $answer["body[{$langcode}][0][value]"] = "Woodchucks do not chuckwood.";
  $this
    ->drupalPost('node/1', $answer, 'Save');
  $this
    ->drupalGet('node/2/delete');
  $this
    ->drupalPost('node/2/delete', array(), 'Delete');
  $this
    ->drupalGet('node/1');
  $this
    ->clickLink('Best');
  $this
    ->drupalGet('node/1/delete');
  $this
    ->drupalPost('node/1/delete', array(), 'Delete');
}