function Faq_AskAccessTestClass::testFaqAccess in FAQ_Ask 7
File
- ./faq_ask.test, line 329
- Test Faq_Ask functionality Base test class. All tests inherits this one
Hugely based on code from the test file block.test by boombatower
Class
- Faq_AskAccessTestClass
Code
function testFaqAccess() {
$this
->faqVerifyNoAccess('faq-page');
$normal_user = $this
->drupalCreateUser();
$this
->drupalLogin($normal_user);
$this
->faqVerifyNoAccess('faq-page');
$this
->drupalLogout();
$view_faq_user = $this
->drupalCreateUser(array(
'view faq page',
));
$this
->drupalLogin($view_faq_user);
$this
->drupalGet('faq-page');
$this
->assertText(t('Frequently Asked Questions'), t('FAQ page is available for view faq page permissions.'));
$this
->drupalLogin($this->admin_user);
$oldvocabvid = $this->vocabulary->vid;
$terms = array();
foreach (taxonomy_term_load_multiple(array(), array(
'vid' => $oldvocabvid,
)) as $obj) {
$terms[] = $obj->name;
}
$this
->setupTaxonomy();
$settings = array(
'faq_omit_vocabulary[' . $oldvocabvid . ']' => TRUE,
'faq_omit_vocabulary[' . $this->vocabulary->vid . ']' => FALSE,
);
$this
->drupalPost('admin/config/content/faq/categories', $settings, t('Save configuration'));
$settings = array(
'faq_ask_vocabularies[]' => array(
$this->vocabulary->vid,
),
);
$this
->setFaqAskSettings($settings);
$this
->pass('<pre>' . print_r($terms, TRUE) . '</pre>');
foreach ($terms as $term) {
$this
->assertNoText($term, t('Term @term is not visible on the experts page', array(
'@term' => $term,
)));
}
$terms = array();
foreach (taxonomy_term_load_multiple(array(), array(
'vid' => $this->vocabulary->vid,
)) as $obj) {
$terms[] = $obj->name;
}
$this
->pass('<pre>' . print_r($terms, TRUE) . '</pre>');
foreach ($terms as $term) {
$this
->assertText($term, t('Term @term is visible on the experts page', array(
'@term' => $term,
)));
}
}