You are here

public function AnswersBestTestCase::testBestAnswerLocksConfig in Answers 7.4

Test Best Answer locks question.

File

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

Class

AnswersBestTestCase
Tests the functionality of the answers_userpoints module admin settings.

Code

public function testBestAnswerLocksConfig() {
  $langcode = LANGUAGE_NONE;
  $big_user = $this
    ->drupalCreateUser(array(
    'administer content types',
  ));
  $this
    ->drupalLogin($big_user);
  $this
    ->drupalGet('admin/config/content/answers');
  $this
    ->assertResponse(200);
  $config = array(
    'answers_best_answer_lock_questions_p' => TRUE,
    'answers_best_answer_lock_choice_p' => FALSE,
  );
  $this
    ->drupalPost('admin/config/content/answers', $config, 'Save configuration');
  $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
    ->assertText('Note: This question is locked.');
  $this
    ->clickLink('Unbest');
  $this
    ->assertNoText('Note: This question is locked.');
}