You are here

protected function AbstractOpignoTestCase::configureOpigno in Opigno 7.0

1 call to AbstractOpignoTestCase::configureOpigno()
OpignoAssessmentTestCase::setUp in modules/opigno_assessment/tests/opigno_assessment.test
Sets up a Drupal site for running functional and integration tests.

File

tests/AbstractOpignoTestCase.inc, line 19
Defines the base class for Opigno unit testing. This base class contains re-usable logic that will make it easier and faster to write Opigno-specific unit tests. This class will also configure all modules to work correctly for Opigno.

Class

AbstractOpignoTestCase
@file Defines the base class for Opigno unit testing. This base class contains re-usable logic that will make it easier and faster to write Opigno-specific unit tests. This class will also configure all modules to work correctly for Opigno.

Code

protected function configureOpigno() {
  if (!isset($this->admin_user)) {

    // Create admin user
    $permissions = array();
    foreach (array(
      'node',
      'opigno',
      'og',
      'quiz',
    ) as $module) {
      $permissions = array_merge(array_keys(module_invoke($module, 'permission')), $permissions);
    }
    $this->admin_user = $this
      ->drupalCreateUser($permissions);
  }

  // Login admin user
  $this
    ->drupalLogin($this->admin_user);

  // Configure group types

  /* Done in features module
     foreach (array('course', 'workgroup') as $type) {
       $this->configureOGGroupType($type);
     }
     */

  // Configure group content types
  foreach (array(
    'calendar_entry',
    'glossary',
    'quiz',
    'wiki',
    'workgroup',
  ) as $type) {
    $this
      ->configureOGContentType($type);
  }

  // Logout admin user
  $this
    ->drupalLogout($this->admin_user);
}