3 namespace Drupal\Tests\migrate_drupal_ui\Functional\d6;
5 use Drupal\node\Entity\Node;
6 use Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeExecuteTestBase;
7 use Drupal\user\Entity\User;
10 * Tests Drupal 6 upgrade using the migrate UI.
12 * The test method is provided by the MigrateUpgradeTestBase class.
14 * @group migrate_drupal_ui
16 class MigrateUpgrade6Test extends MigrateUpgradeExecuteTestBase {
23 public static $modules = [
25 'content_translation',
33 'migration_provider_test',
34 // Required for translation migrations.
35 'migrate_drupal_multilingual',
41 protected function setUp() {
43 $this->loadFixture(drupal_get_path('module', 'migrate_drupal') . '/tests/fixtures/drupal6.php');
49 protected function getSourceBasePath() {
50 return __DIR__ . '/files';
56 protected function getEntityCounts() {
58 'aggregator_item' => 1,
59 'aggregator_feed' => 2,
62 'block_content_type' => 1,
64 // The 'standard' profile provides the 'comment' comment type, and the
65 // migration creates 12 comment types, one per node type.
68 'configurable_language' => 5,
71 'field_storage_config' => 64,
75 'language_content_settings' => 10,
78 // The 'book' module provides the 'book' node type, and the migration
79 // creates 12 node types.
88 'taxonomy_vocabulary' => 7,
92 'menu_link_content' => 10,
95 'entity_form_display' => 29,
96 'entity_form_mode' => 1,
97 'entity_view_display' => 55,
98 'entity_view_mode' => 14,
99 'base_field_override' => 38,
106 protected function getEntityCountsIncremental() {
107 $counts = $this->getEntityCounts();
108 $counts['block_content'] = 3;
109 $counts['comment'] = 9;
110 $counts['entity_view_display'] = 55;
111 $counts['entity_view_mode'] = 14;
113 $counts['menu_link_content'] = 11;
114 $counts['node'] = 19;
115 $counts['taxonomy_term'] = 9;
117 $counts['view'] = 16;
124 protected function getAvailablePaths() {
164 // Include modules that do not have an upgrade path and are enabled in the
165 // source database, defined in the $noUpgradePath property
166 // in MigrateUpgradeForm.
181 protected function getMissingPaths() {
188 * Executes all steps of migrations upgrade.
190 public function testMigrateUpgradeExecute() {
191 parent::testMigrateUpgradeExecute();
193 // Ensure migrated users can log in.
194 $user = User::load(2);
195 $user->passRaw = 'john.doe_pass';
196 $this->drupalLogin($user);
197 $this->assertFollowUpMigrationResults();
201 * Tests that follow-up migrations have been run successfully.
203 protected function assertFollowUpMigrationResults() {
204 $node = Node::load(10);
205 $this->assertSame('12', $node->get('field_reference')->target_id);
206 $this->assertSame('12', $node->get('field_reference_2')->target_id);
207 $translation = $node->getTranslation('fr');
208 $this->assertSame('12', $translation->get('field_reference')->target_id);
209 $this->assertSame('12', $translation->get('field_reference_2')->target_id);
211 $node = Node::load(12)->getTranslation('en');
212 $this->assertSame('10', $node->get('field_reference')->target_id);
213 $this->assertSame('10', $node->get('field_reference_2')->target_id);
214 $translation = $node->getTranslation('fr');
215 $this->assertSame('10', $translation->get('field_reference')->target_id);
216 $this->assertSame('10', $translation->get('field_reference_2')->target_id);