You are here

function FaqAccessTestClass::testFaqAccess in Frequently Asked Questions 7

Same name and namespace in other branches
  1. 6 faq.test \FaqAccessTestClass::testFaqAccess()
  2. 7.2 faq.test \FaqAccessTestClass::testFaqAccess()

File

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

Class

FaqAccessTestClass

Code

function testFaqAccess() {

  // Verify that anonymous user has no access to the faq page
  $this
    ->faqVerifyNoAccess(_faq_path());

  // Create and login user
  $normal_user = $this
    ->drupalCreateUser();
  $this
    ->drupalLogin($normal_user);

  // Verify that logged in user has no access to the faq page
  $this
    ->faqVerifyNoAccess(_faq_path());
  $this
    ->drupalLogout();
  $view_faq_user = $this
    ->drupalCreateUser(array(
    'view faq page',
  ));
  $this
    ->drupalLogin($view_faq_user);

  // Verify that the faq page is visible and available but empty
  $this
    ->drupalGet(_faq_path());
  $this
    ->assertText(t('Frequently Asked Questions'), t('FAQ page is available for view faq page permissions.'));
}