function MigrateTableUnitTest::testTableImport in Migrate 6.2
Same name and namespace in other branches
- 7.2 tests/plugins/destinations/table.test \MigrateTableUnitTest::testTableImport()
File
- tests/
plugins/ destinations/ table.test, line 24
Class
- MigrateTableUnitTest
- Test table migration.
Code
function testTableImport() {
$migration = Migration::getInstance('WineTable');
$result = $migration
->processImport();
$this
->assertEqual($result, Migration::RESULT_COMPLETED, t('Table import returned RESULT_COMPLETED'));
$result = db_query("SELECT COUNT(*)\n FROM {migrate_example_wine_table_source} s\n INNER JOIN {migrate_map_winetable} map ON s.fooid=map.sourceid1\n INNER JOIN {migrate_example_wine_table_dest} d ON map.destid1=d.recordid");
$this
->assertEqual(db_result($result), 3, t('Count of imported records is correct'));
// Test rollback
$result = $migration
->processRollback();
$this
->assertEqual($result, Migration::RESULT_COMPLETED, t('Variety term rollback returned RESULT_COMPLETED'));
$result = db_query("SELECT COUNT(*) FROM {migrate_example_wine_table_dest}");
$this
->assertEqual(db_result($result), 0, t('All migrated rows removed'));
$result = db_query("SELECT COUNT(*) FROM {migrate_map_winetable}");
$this
->assertEqual(db_result($result), 0, t('All map rows removed'));
}