function FaqAskBlockTestClass::testQuestionForm in FAQ_Ask 6.2
File
- ./faq_ask.test, line 256
- Test FAQ functionality Base test class. All tests inherits this one.
Hugely based on code from the test file block.test by boombatower
Class
- FaqAskBlockTestClass
Code
function testQuestionForm() {
$this
->drupalLogin($this->admin_user);
$this
->drupalPost('admin/build/block/configure/faq_ask/1', array(
'visibility' => '1',
'pages' => '<front>',
), t('Save block'));
$this
->drupalPost('admin/build/block', array(
'faq_ask_1[region]' => 'right',
), t('Save blocks'));
$this
->drupalGet('admin/build/block/configure/faq_ask/1');
$this
->drupalLogout();
$this
->drupalGet('');
$this
->assertNoText(t('Ask a Question'), t('The Ask a Question block is not visible for anonymous users'));
$this
->drupalLogin($this->faq_asker);
$this
->drupalGet('');
$this
->assertText(t('Ask a Question'), t('Ask a Question page is available for anonymous users.'));
$this
->assertText($this->taxonomy['name'], 'Taxonomy field visible');
$this
->turnUnansQestBlockOn();
$this
->drupalLogin($this->faq_asker);
$this
->assertNoText('You may edit your own questions until they are answered.', 'Unanswered list is not available yet');
$this->faq1 = array();
$this->faq1['title'] = $this
->randomName(8);
$this->faq1['taxonomy[tags][1]'] = $this->term1['name'];
$this->faq1['detailed_question'] = $this
->randomName(16);
$this->faq1['faq_notify'] = TRUE;
$this
->drupalPost('', $this->faq1, t('Save'));
$this
->assertText(t('FAQ @title has been created.', array(
'@title' => $this->faq1['title'],
)));
$this
->assertText('You may edit your own questions until they are answered.', 'Unanswered list is not available yet');
$this
->drupalGet('');
$this
->assertText($this->faq1['title'], 'Own question still visible in block.');
}