385a4e58040a3d95acefd61a9572674ba4be0a2e
[yaffs-website] / web / core / modules / migrate_drupal_ui / tests / src / Functional / d7 / MigrateUpgrade7Test.php
1 <?php
2
3 namespace Drupal\Tests\migrate_drupal_ui\Functional\d7;
4
5 use Drupal\Tests\migrate_drupal_ui\Functional\MigrateUpgradeExecuteTestBase;
6 use Drupal\user\Entity\User;
7
8 /**
9  * Tests Drupal 7 upgrade using the migrate UI.
10  *
11  * The test method is provided by the MigrateUpgradeTestBase class.
12  *
13  * @group migrate_drupal_ui
14  */
15 class MigrateUpgrade7Test extends MigrateUpgradeExecuteTestBase {
16
17   /**
18    * Modules to enable.
19    *
20    * @var array
21    */
22   public static $modules = [
23     'file',
24     'language',
25     'content_translation',
26     'migrate_drupal_ui',
27     'telephone',
28     'aggregator',
29     'book',
30     'forum',
31     'statistics',
32     'migration_provider_test',
33   ];
34
35   /**
36    * {@inheritdoc}
37    */
38   protected function setUp() {
39     parent::setUp();
40     $this->loadFixture(drupal_get_path('module', 'migrate_drupal') . '/tests/fixtures/drupal7.php');
41   }
42
43   /**
44    * {@inheritdoc}
45    */
46   protected function getSourceBasePath() {
47     return __DIR__ . '/files';
48   }
49
50   /**
51    * {@inheritdoc}
52    */
53   protected function getEntityCounts() {
54     return [
55       'aggregator_item' => 11,
56       'aggregator_feed' => 1,
57       'block' => 25,
58       'block_content' => 1,
59       'block_content_type' => 1,
60       'comment' => 1,
61       // The 'standard' profile provides the 'comment' comment type, and the
62       // migration creates 6 comment types, one per node type.
63       'comment_type' => 7,
64       // Module 'language' comes with 'en', 'und', 'zxx'. Migration adds 'is'.
65       'configurable_language' => 4,
66       'contact_form' => 3,
67       'editor' => 2,
68       'field_config' => 63,
69       'field_storage_config' => 46,
70       'file' => 3,
71       'filter_format' => 7,
72       'image_style' => 6,
73       'language_content_settings' => 2,
74       'migration' => 73,
75       'node' => 5,
76       'node_type' => 6,
77       'rdf_mapping' => 7,
78       'search_page' => 2,
79       'shortcut' => 6,
80       'shortcut_set' => 2,
81       'action' => 17,
82       'menu' => 6,
83       'taxonomy_term' => 18,
84       'taxonomy_vocabulary' => 4,
85       'tour' => 4,
86       'user' => 4,
87       'user_role' => 3,
88       'menu_link_content' => 8,
89       'view' => 16,
90       'date_format' => 11,
91       'entity_form_display' => 17,
92       'entity_form_mode' => 1,
93       'entity_view_display' => 28,
94       'entity_view_mode' => 14,
95       'base_field_override' => 9,
96     ];
97   }
98
99   /**
100    * {@inheritdoc}
101    */
102   protected function getEntityCountsIncremental() {
103     $counts = $this->getEntityCounts();
104     $counts['block_content'] = 2;
105     $counts['comment'] = 2;
106     $counts['file'] = 4;
107     $counts['menu_link_content'] = 9;
108     $counts['node'] = 6;
109     $counts['taxonomy_term'] = 19;
110     $counts['user'] = 5;
111     return $counts;
112   }
113
114   /**
115    * {@inheritdoc}
116    */
117   protected function getAvailablePaths() {
118     return [
119       'aggregator',
120       'block',
121       'comment',
122       'contact',
123       'date',
124       'dblog',
125       'email',
126       'entityreference',
127       'field',
128       'field_sql_storage',
129       'file',
130       'filter',
131       'forum',
132       'image',
133       'language',
134       'link',
135       'list',
136       'locale',
137       'menu',
138       'node',
139       'number',
140       'options',
141       'path',
142       'phone',
143       'search',
144       'shortcut',
145       'statistics',
146       'system',
147       'taxonomy',
148       'text',
149       'user',
150       // Include modules that do not have an upgrade path and are enabled in the
151       // source database, defined in the $noUpgradePath property
152       // in MigrateUpgradeForm.
153       'blog',
154       'contextual',
155       'date_api',
156       'entity',
157       'field_ui',
158       'help',
159       'php',
160       'simpletest',
161       'toolbar',
162       'translation',
163       'trigger',
164     ];
165   }
166
167   /**
168    * {@inheritdoc}
169    */
170   protected function getMissingPaths() {
171     return [
172       'book',
173       'color',
174       'rdf',
175       // These modules are in the missing path list because they are installed
176       // on the source site but they are not installed on the destination site.
177       'syslog',
178       'tracker',
179       'update',
180     ];
181   }
182
183   /**
184    * Executes all steps of migrations upgrade.
185    */
186   public function testMigrateUpgradeExecute() {
187     parent::testMigrateUpgradeExecute();
188
189     // Ensure migrated users can log in.
190     $user = User::load(2);
191     $user->passRaw = 'a password';
192     $this->drupalLogin($user);
193   }
194
195 }