public function OgMigrate7000TestCase::setUp in Organic groups 7.2
Same name and namespace in other branches
- 7 og_migrate/og_migrate.test \OgMigrate7000TestCase::setUp()
Overrides DrupalWebTestCase::setUp() for upgrade testing.
Overrides UpgradePathTestCase::setUp
See also
DrupalWebTestCase::prepareDatabasePrefix()
DrupalWebTestCase::changeDatabasePrefix()
DrupalWebTestCase::prepareEnvironment()
File
- ./
og.test, line 935
Class
- OgMigrate7000TestCase
- Upgrade 7000 test.
Code
public function setUp() {
// Path to the database dump.
$this->databaseDumpFiles = array(
drupal_get_path('module', 'og') . '/tests/drupal-6.og.database.php',
);
parent::setUp();
$this
->assertTrue($this
->performUpgrade(), t('The upgrade was completed successfully.'));
// spl_autoload_register() wasn't called, so we do it here, to allow
// classes to be auto-loaded.
spl_autoload_register('drupal_autoload_class');
spl_autoload_register('drupal_autoload_interface');
// TODO: Why do we need to enable Views?!
module_enable(array(
'og',
'views',
'migrate',
));
$class_names = array(
'OgMigrateAddFields',
'OgMigrateUser',
'OgMigrateContent',
);
// FIXME: migrate_flush_caches() crashes, so we register manually.
foreach ($class_names as $class_name) {
MigrationBase::registerMigration($class_name);
}
// Register a dynamic migration.
MigrationBase::registerMigration('OgMigrateGroup', 'OgMigrateGroupTest_group', array(
'bundle' => 'test_group',
));
$migration = Migration::getInstance('OgMigrateAddFields');
$result = $migration
->processImport();
$this
->assertEqual($result, Migration::RESULT_COMPLETED, 'Migration OgMigrateAddFields executed.');
$migration = Migration::getInstance('OgMigrateGroupTest_group', 'OgMigrateGroup', array(
'bundle' => 'test_group',
));
$result = $migration
->processImport();
$this
->assertEqual($result, Migration::RESULT_COMPLETED, 'Migration OgMigrateGroupTest_group executed.');
$migration = Migration::getInstance('OgMigrateUser');
$result = $migration
->processImport();
$this
->assertEqual($result, Migration::RESULT_COMPLETED, 'Migration OgMigrateUser executed.');
$migration = Migration::getInstance('OgMigrateContent');
$result = $migration
->processImport();
$this
->assertEqual($result, Migration::RESULT_COMPLETED, 'Migration OgMigrateContent executed.');
}