You are here

public function OgMigrate7000TestCase::setUp in Organic groups 7

Same name and namespace in other branches
  1. 7.2 og.test \OgMigrate7000TestCase::setUp()

Overrides DrupalWebTestCase::setUp() for upgrade testing.

Overrides UpgradePathTestCase::setUp

See also

DrupalWebTestCase::prepareDatabasePrefix()

DrupalWebTestCase::changeDatabasePrefix()

DrupalWebTestCase::prepareEnvironment()

File

og_migrate/og_migrate.test, line 18

Class

OgMigrate7000TestCase
Upgrade 7000 test.

Code

public function setUp() {

  // Path to the database dump.
  $this->databaseDumpFiles = array(
    drupal_get_path('module', 'og_migrate') . '/tests/drupal-6.og.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',
  ));
  module_enable(array(
    'og_migrate',
  ));

  // 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);

  // TODO: Execute programtically the batch process.
}