public function AnswersUserPointsTestCase::testOwnBestAnswer in Answers 7.4
Test Best Answer points for own answer.
File
- answers_userpoints/
answers_userpoints.test, line 53 - Tests for answers_userpoints.module.
Class
- AnswersUserPointsTestCase
- Tests the functionality of the answers_userpoints module admin settings.
Code
public function testOwnBestAnswer() {
$langcode = LANGUAGE_NONE;
$this
->drupalLogin($this->questionUser);
$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]"] = "4096 cords of wood.";
$this
->drupalPost('node/1', $answer, 'Save');
$this
->assertLink('Best', 0, 'Best Answer link exists');
$this
->clickLink('Best', 0);
$this
->assertEqual(0, userpoints_get_current_points($this->questionUser->uid), 'Question author\'s points = 2');
$this
->clickLink('Unbest', 0);
$this
->assertEqual(0, userpoints_get_current_points($this->questionUser->uid), 'Question author\'s points = 0');
}