// Test that menus are not alterable when the i18nmenu is not enabled.
$this->sourceDatabase->update('system') ->fields(['status' => 0]) ->condition('name', 'i18nmenu') ->execute();
/**
* Tests the Drupal 6 taxonomy vocabularies to Drupal 8 migration.
*/ publicfunctiontestTaxonomyVocabulary(){ for($i = 0; $i < 3; $i++){ $j = $i + 1; $vocabulary = Vocabulary::load("vocabulary_{$j}_i_{$i}_"); $this->assertSame($this->getMigration('d6_taxonomy_vocabulary')->getIdMap()->lookupDestinationIds([$j]), [[$vocabulary->id()]]); $this->assertSame("vocabulary $j (i=$i)", $vocabulary->label()); $this->assertSame("description of vocabulary $j (i=$i)", $vocabulary->getDescription()); $this->assertSame(4 + $i, $vocabulary->get('weight')); } $vocabulary = Vocabulary::load('vocabulary_name_much_longer_th'); $this->assertSame('vocabulary name much longer than thirty two characters', $vocabulary->label()); $this->assertSame('description of vocabulary name much longer than thirty two characters', $vocabulary->getDescription()); $this->assertSame(7, $vocabulary->get('weight')); }
}
$migration_ids = array_keys($migrations); // Check if there are conflicts. If none, just skip this form!
$migrations = $this->migrationPluginManager->createInstances($migration_ids);
/** @var \Drupal\migrate\Audit\AuditResult $result */ foreach($resultsas$result){ $destination = $result->getMigration()->getDestinationPlugin(); if($destination instanceof EntityContentBase && $destination->isTranslationDestination()){ // Translations are not yet supported by the audit system. For now, we
// only warn the user to be cautious when migrating translated content.
// I18n support should be added in https://www.drupal.org/node/2905759.
$translated_content_conflicts[] = $result; } elseif(!$result->passed()){ $content_conflicts[] = $result; } }
/**
* Tests exception in thrown when the i18n_variable table does not exist.
*/ publicfunctiontestCheckRequirements(){ $this->expectException(RequirementsException::class); $this->expectExceptionMessage("Source database table 'i18n_variable' does not exist"); $this->getMigration('d6_system_maintenance_translation') ->getSourcePlugin() ->checkRequirements(); }
/**
* Runs the actual test.
*
* @param string $message
* The second message to assert.
* @param bool $memory_exceeded
* Whether to test the memory exceeded case.
* @param int|null $memory_usage_first
* (optional) The first memory usage value. Defaults to NULL.
* @param int|null $memory_usage_second
* (optional) The fake amount of memory usage reported after memory reclaim.
* Defaults to NULL.
* @param int|null $memory_limit
* (optional) The memory limit. Defaults to NULL.
*/
/**
* Tests that the profile value process is added to the pipeline.
*
* Ensures profile fields are merged into the d7_profile_values migration's
* process pipeline.
*/ publicfunctiontestClass(){ $migration = $this->getMigration('d7_user'); /** @var \Drupal\migrate\Plugin\MigrationInterface[] $migrations */ $this->assertSame('d7_user', $migration->id()); $process = $migration->getProcess(); $this->assertSame('field_file', $process['field_file'][0]['source']); }
$long_date_format = DateFormat::load('long'); $this->assertSame('\L\O\N\G l, F j, Y - H:i', $long_date_format->getPattern());
// Test that we can re-import using the EntityDateFormat destination.
Database::getConnection('default', 'migrate') ->update('variable') ->fields(['value' => serialize('\S\H\O\R\T d/m/Y - H:i')]) ->condition('name', 'date_format_short') ->execute();
/**
* Test cases for ::testCheckCommentTypeRequirements().
*/ publicfunctionproviderTestCheckCommentTypeRequirements(){ return[ 'D6 comment is disabled on source' => [ 'Disabled source modules' => ['comment'],
The navigation menu is provided by Drupal and is the main interactive menu for any site. It is usually the only menu that contains personalized links for authenticated users, and is often not even visible to anonymous users.
EOT; $this->assertSame($expected, $navigation_menu->getDescription());
// Test that we can re-import using the ConfigEntityBase destination.
Database::getConnection('default', 'migrate') ->update('menu_custom') ->fields(['title' => 'Home Navigation']) ->condition('menu_name', 'navigation') ->execute();
/**
* Tests an import with an incomplete rewinding.
*/ publicfunctiontestImportWithFailingRewind(){ $exception_message = $this->getRandomGenerator()->string();