You are here

function FaqTestCase::setUp in Frequently Asked Questions 7.2

Same name and namespace in other branches
  1. 6 faq.test \FaqTestCase::setUp()
  2. 7 faq.test \FaqTestCase::setUp()

Implementation of setUp().

Overrides DrupalWebTestCase::setUp

File

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

Class

FaqTestCase
Base class that is extended by test cases

Code

function setUp() {

  // Install FAQ Module.
  parent::setUp('taxonomy', 'faq');

  // Create and log in user with administer taxonomy permissions.
  $this->admin_user = $this
    ->drupalCreateUser(array(
    'administer taxonomy',
    'administer faq',
    'administer faq order',
    'administer blocks',
  ));
  $this
    ->drupalLogin($this->admin_user);
  $this->faq_user = $this
    ->drupalCreateUser(array(
    'create faq content',
    'edit any faq content',
    'delete any faq content',
    'view faq page',
    'access content',
  ));

  // Set up the vocab and terms.
  $this
    ->setupTaxonomy();

  // Categorize questions.
  $this
    ->drupalPost('admin/config/content/faq/categories', array(
    'faq_use_categories' => '1',
  ), t('Save configuration'));

  // Set answer_user as default expert.
  $roles = $this->faq_user->roles;
  end($roles);

  // Set to last role (the unique one)
  // Start all tests logged out.
  $this
    ->drupalLogout();
}