diff --git a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Language.php b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Language.php index 5d78fb7..85e0e0a 100644 --- a/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Language.php +++ b/core/modules/migrate_drupal/lib/Drupal/migrate_drupal/Plugin/migrate/source/d6/Language.php @@ -52,4 +52,4 @@ public function checkRequirements() { return $this->moduleExists('locale'); } -} \ No newline at end of file +} diff --git a/core/modules/migrate_drupal/tests/Drupal/migrate_drupal/Tests/source/d6/LanguageSourceTest.php b/core/modules/migrate_drupal/tests/Drupal/migrate_drupal/Tests/source/d6/LanguageSourceTest.php new file mode 100644 index 0000000..975aff4 --- /dev/null +++ b/core/modules/migrate_drupal/tests/Drupal/migrate_drupal/Tests/source/d6/LanguageSourceTest.php @@ -0,0 +1,133 @@ + 'test', + // Leave it empty for now. + 'idlist' => array(), + // This needs to be the identifier of the actual key: cid for comment, nid + // for node and so on. + 'source' => array( + 'plugin' => 'drupal6_language', + ), + 'sourceIds' => array( + 'language' => array( + // This is where the field schema would go but for now we need to + // specify the table alias for the key. Most likely this will be the + // same as BASE_ALIAS. + 'alias' => 'l', + ), + ), + 'destinationIds' => array( + 'id' => array( + // This is where the field schema would go. + ), + ), + ); + + protected $expectedResults = array( + array( + 'language' => 'es', + 'name' => 'Spanish', + 'native' => 'Español', + 'direction' => 0, + 'enabled' => 1, + 'plurals' => 0, + 'formula' => '', + 'domain' => '', + 'prefix' => 'es', + 'weight' => -3, + 'javascript' => '', + ), + array( + 'language' => 'en', + 'name' => 'English', + 'native' => 'English', + 'direction' => 0, + 'enabled' => 1, + 'plurals' => 0, + 'formula' => '', + 'domain' => '', + 'prefix' => '', + 'weight' => 0, + 'javascript' => '', + ), + ); + + protected $databaseContents = array( + 'languages' => array( + array( + 'language' => 'es', + 'name' => 'Spanish', + 'native' => 'Español', + 'direction' => 0, + 'enabled' => 1, + 'plurals' => 0, + 'formula' => '', + 'domain' => '', + 'prefix' => 'es', + 'weight' => -3, + 'javascript' => '', + ), + array( + 'language' => 'en', + 'name' => 'English', + 'native' => 'English', + 'direction' => 0, + 'enabled' => 1, + 'plurals' => 0, + 'formula' => '', + 'domain' => '', + 'prefix' => '', + 'weight' => 0, + 'javascript' => '', + ), + )); + + /** + * {@inheritdoc} + */ + public static function getInfo() { + return array( + 'name' => 'D6 language source functionality', + 'description' => 'Tests D6 language source plugin.', + 'group' => 'Migrate Drupal', + ); + } +} + + +use Drupal\Core\Database\Connection; +use Drupal\Core\Extension\ModuleHandlerInterface; +use Drupal\migrate_drupal\Plugin\migrate\source\d6\Language; + +class TestLanguage extends Language { + function setDatabase(Connection $database) { + $this->database = $database; + } + function setModuleHandler(ModuleHandlerInterface $module_handler) { + $this->moduleHandler = $module_handler; + } +}