You are here

public function AnswersTaxonomyTestCase::testTagNewContent in Answers 7.4

Create Question with tags.

File

answers_taxonomy/answers_taxonomy.test, line 41
Tests for answers.module.

Class

AnswersTaxonomyTestCase
Tests the functionality of the answers_userpoints module admin settings.

Code

public function testTagNewContent() {
  $langcode = LANGUAGE_NONE;
  $this
    ->drupalLogin($this->answersUser);
  $this
    ->drupalGet('node/add/answers-question');
  $this
    ->assertFieldByName('title', '', 'The title field exists');
  $this
    ->assertFieldByName("body[{$langcode}][0][value]", '', 'The body field exists');
  $question = array();
  $question['title'] = 'Woodchucks';
  $question["body[{$langcode}][0][value]"] = "How much wood could a woodchuck chuck?";
  $question["answers_tags[und]"] = "animal, mamal, woodchuck";
  $this
    ->drupalPost('node/add/answers-question', $question, 'Save');
  $this
    ->drupalGet('tags');
  $this
    ->assertLink('animal', 0, 'A link to "animal" taxonomy term.');
  $this
    ->assertRaw('<span class="views-field views-field-nid">        <span class="field-content">1</span>  </span>', 'Number of Questions with tag.');
}