You are here

public function OgUiUpgradePathTestCase::setUp in Organic groups 7

Overrides DrupalWebTestCase::setUp() for upgrade testing.

Overrides UpgradePathTestCase::setUp

See also

DrupalWebTestCase::prepareDatabasePrefix()

DrupalWebTestCase::changeDatabasePrefix()

DrupalWebTestCase::prepareEnvironment()

File

og_ui/og_ui.test, line 205

Class

OgUiUpgradePathTestCase
Upgrade test.

Code

public function setUp() {

  // Path to the database dump.
  $this->databaseDumpFiles = array(
    drupal_get_path('module', 'og_ui') . '/tests/drupal-6.og-ui.database.php',
  );
  parent::setUp();
  $this
    ->performUpgrade();

  // og_update_7001 required Entity module to be enabled, so we enable the
  // modules an re-run upgrade.
  // TODO: Understand why this workround is needed to load all entity classes.
  module_enable(array(
    'entity',
  ));
  module_load_include('inc', 'entity', 'includes/entity');
  module_load_include('inc', 'entity', 'includes/entity.controller');
  module_enable(array(
    'og_migrate',
    'og_ui',
  ));

  // Rebuild menu so og-migrate items are added.
  menu_rebuild();

  // Set small batch sizes, so we can simulate upgrade with many records.
  variable_set('og_update_batch_size', 3);
  $this
    ->drupalLogout();
  $admin_user = $this
    ->drupalCreateUser(array(
    'access administration pages',
  ));
  $this
    ->drupalLogin($admin_user);

  // Make sure Organic group fields are recognized by the field system.
  _field_info_collate_fields(TRUE);
  _field_info_collate_types(TRUE);
}