You are here

function FaqAskCRUDTestClass::testEditOwnFaqAskQuestion in FAQ_Ask 6.2

File

./faq_ask.test, line 498
Test FAQ functionality Base test class. All tests inherits this one. Hugely based on code from the test file block.test by boombatower

Class

FaqAskCRUDTestClass

Code

function testEditOwnFaqAskQuestion() {

  // Check logged in user who created question faq4
  $this
    ->drupalLogin($this->faq_asker);
  $this->faq4['faq_notify'] = TRUE;
  $this
    ->drupalPost('faq_ask', $this->faq4, t('Save'));

  // Verify own question on unanswered page
  $this
    ->drupalGet('faq_ask/unanswered');
  $this
    ->assertText($this->faq4['title'], 'User can see own node on unanswered page.');

  // Can edit own question?
  $this
    ->clickLink($this->faq4['title']);
  $this
    ->assertFieldByName('title', $this->faq4['title'], 'Title field content kept in edit.');
  $this
    ->assertFieldByName('taxonomy[tags][1]', $this->faq4['taxonomy[tags][1]'], 'Taxonomy term field content kept in edit.');
  $this
    ->assertFieldByName('detailed_question', $this->faq4['detailed_question'], 'Detailed question field content kept in edit.');
  $url = $this
    ->getUrl();
  $this->faq4['detailed_question'] = $this
    ->randomName(30);
  $this
    ->drupalPost($url, $this->faq4, t('Save'));
  $this
    ->assertText(t('FAQ @name has been updated.', array(
    '@name' => $this->faq4['title'],
  )), 'Modified question saved OK');
  $this
    ->drupalGet($url);

  // Go to edit page again
  $this
    ->assertFieldByName('detailed_question', $this->faq4['detailed_question'], 'Detailed question field content changed after edit.');
}