You are here

public function AdminViewsWebTestCase::setUp in Administration Views 7

Sets up a Drupal site for running functional and integration tests.

Generates a random database prefix and installs Drupal with the specified installation profile in DrupalWebTestCase::$profile into the prefixed database. Afterwards, installs any additional modules specified by the test.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Parameters

...: List of modules to enable for the duration of the test. This can be either a single array or a variable number of string arguments.

Overrides DrupalWebTestCase::setUp

See also

DrupalWebTestCase::prepareDatabasePrefix()

DrupalWebTestCase::changeDatabasePrefix()

DrupalWebTestCase::prepareEnvironment()

5 calls to AdminViewsWebTestCase::setUp()
AdminViewsAccessHandlerTestCase::setUp in tests/admin_views.test
Sets up a Drupal site for running functional and integration tests.
AdminViewsDefaultViewsTestCase::setUp in tests/admin_views.test
Sets up a Drupal site for running functional and integration tests.
AdminViewsNodeAdminTestCase::setUp in tests/admin_views.test
Sets up a Drupal site for running functional and integration tests.
AdminViewsPageDisplayTestCase::setUp in tests/admin_views.test
Sets up a Drupal site for running functional and integration tests.
AdminViewsSystemDisplayTestCase::setUp in tests/admin_views.test
Sets up a Drupal site for running functional and integration tests.
5 methods override AdminViewsWebTestCase::setUp()
AdminViewsAccessHandlerTestCase::setUp in tests/admin_views.test
Sets up a Drupal site for running functional and integration tests.
AdminViewsDefaultViewsTestCase::setUp in tests/admin_views.test
Sets up a Drupal site for running functional and integration tests.
AdminViewsNodeAdminTestCase::setUp in tests/admin_views.test
Sets up a Drupal site for running functional and integration tests.
AdminViewsPageDisplayTestCase::setUp in tests/admin_views.test
Sets up a Drupal site for running functional and integration tests.
AdminViewsSystemDisplayTestCase::setUp in tests/admin_views.test
Sets up a Drupal site for running functional and integration tests.

File

tests/admin_views.test, line 24
Tests for the Administration Views module.

Class

AdminViewsWebTestCase
Base class for all Administration Views web test cases.

Code

public function setUp(array $modules = array()) {

  // Setup site and modules.
  $modules[] = 'admin_views_system_display';
  $modules[] = 'admin_views';
  parent::setUp($modules);

  // Fix testing environment.
  theme_enable(array(
    'stark',
  ));
  variable_set('theme_default', 'stark');

  // Setup permissions.
  $permissions = array(
    'access administration pages',
  );
  foreach ($this->permissionMap as $module => $module_permissions) {
    if (module_exists($module)) {
      $permissions = array_merge($permissions, $module_permissions);
    }
  }
  $this->admin_user = $this
    ->drupalCreateUser($permissions);

  // Setup default configuration.
  if (in_array('node', $modules)) {
    $this->node_type = $this
      ->drupalCreateContentType(array(
      'type' => 'article',
      'name' => 'Article',
      // 2 == COMMENT_NODE_OPEN.
      'comment' => 2,
    ));
  }
  if (in_array('comment', $modules)) {
    variable_set('comment_preview_article', DRUPAL_OPTIONAL);
  }
}