You are here

function FaqAskTestCase::faqAskPostUnansweredQuestions in FAQ_Ask 6.2

2 calls to FaqAskTestCase::faqAskPostUnansweredQuestions()
FaqAskAccessTestClass::testFaqAskAccess in ./faq_ask.test
FaqAskCRUDTestClass::testUnpublishedQuestion in ./faq_ask.test
Testing that the published state of the new question is honoring the content type default

File

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

Class

FaqAskTestCase
Base class that is extended by test cases.

Code

function faqAskPostUnansweredQuestions() {

  // Check logged in user with rights
  $this
    ->drupalLogin($this->faq_asker);

  // Fill in the Create FAQ node 1 form and post it - This is without notification
  $this->faq1 = array();
  $this->faq1['title'] = $this
    ->randomName(8);
  $this->faq1['taxonomy[tags][1]'] = $this->term1['name'];

  // Add existing term
  $this->faq1['detailed_question'] = $this
    ->randomName(16);
  $this->faq1['faq_notify'] = FALSE;
  $this
    ->drupalPost('faq_ask', $this->faq1, t('Save'));

  // Preview first
  // Check that new FAQ node has actually been created
  $this
    ->assertText(t('FAQ @title has been created.', array(
    '@title' => $this->faq1['title'],
  )));

  // Fill in the Create FAQ node 2 form and post it - This is with notification
  $this->faq2 = array();
  $this->faq2['title'] = $this
    ->randomName(8);
  $this->faq2['taxonomy[tags][1]'] = $this
    ->randomName(8);

  // Add new term
  $this->faq2['detailed_question'] = $this
    ->randomName(16);
  $this->faq2['faq_notify'] = TRUE;
  $this
    ->drupalPost('faq_ask', $this->faq2, t('Save'));

  // Check that new FAQ node has actually been created
  $this
    ->assertText(t('FAQ @title has been created.', array(
    '@title' => $this->faq2['title'],
  )));
}