public function AnswersBrandingTestCase::testAddQuestions in Answers 7.3
Test Qustions view page.
File
- ./
answers.test, line 507 - Tests for answers.module.
Class
- AnswersBrandingTestCase
- Tests the functionality of the answers module views.
Code
public function testAddQuestions() {
$langcode = LANGUAGE_NONE;
$user2 = $this
->drupalCreateUser(array(
'administer content types',
'create question content',
'edit own question content',
'create answer content',
'edit own answer content',
));
$this
->drupalLogin($user2);
$this
->drupalGet('node/add/question');
$this
->assertPattern(format_string('|<h1 class="title" id="page-title">
Create !Question </h1>|', answers_translation()), 'Header contains Question.');
$this
->assertPattern(format_string('|<label for="edit-title">!Question |', answers_translation()), 'Title label is Question.');
// @TODO - branding
// $this->assertPattern(
// format_string('|<label class="option"
// for="edit-field-notify-p-und">Notify on !Answer </label>|',
// answers_translation()),
// 'Notifiaction contains Answer'
// );
$this
->assertFieldById('edit-submit', format_string('!answers_question_create_button_text', answers_translation()), format_string('The <em>Save</em> button text. - !answers_question_create_button_text', answers_translation()));
$question = array();
$question['title'] = 'Woodchucks';
$question["body[{$langcode}][0][value]"] = "How much wood could a woodchuck chuck?";
$this
->drupalPost('node/add/question', $question, format_string('!answers_question_create_button_text', answers_translation()));
$this
->drupalGet('questions');
$this
->assertLink(format_string('!Question', answers_translation()));
$this
->assertLink(format_string('!Answers', answers_translation()));
$this
->drupalGet('/questions/unanswered');
$this
->assertLink(format_string('!Question', answers_translation()));
$this
->assertLink(format_string('!Answers', answers_translation()));
$this
->drupalGet('/node/1');
// @TODO - branding
// $this->assertLink(format_string('Post an !Answer',
// answers_translation()));
$this
->assertLink('Post an Answer');
$this
->clickLink('Post an Answer');
$this
->assertPattern(format_string('|<h1 class="title" id="page-title">
Create !Answer </h1>|', answers_translation()), 'Header contains Anseer.');
$this
->assertPattern(format_string('|<label for="edit-title">!Answer |', answers_translation()), 'Title label is Question.');
// @TODO - branding
// $this->assertLink('Post Your Answer');
$this
->assertFieldById('edit-submit', format_string('!answers_answer_create_button_text', answers_translation()), format_string('The <em>Save</em> button text. - !answers_answer_create_button_text', answers_translation()));
}