3 namespace Drupal\Tests\node\Kernel\Plugin\migrate\source\d7;
5 use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
8 * Tests Drupal 7 node entity translations source plugin.
10 * @covers \Drupal\node\Plugin\migrate\source\d7\NodeEntityTranslation
14 class NodeEntityTranslationTest extends MigrateSqlSourceTestBase {
19 public static $modules = ['node', 'user', 'migrate_drupal'];
24 public function providerSource() {
28 $tests[0]['source_data']['entity_translation'] = [
30 'entity_type' => 'node',
38 'created' => 1531343498,
39 'changed' => 1531343498,
42 'entity_type' => 'node',
50 'created' => 1531343508,
51 'changed' => 1531343508,
54 'entity_type' => 'node',
62 'created' => 1531343528,
63 'changed' => 1531343528,
66 $tests[0]['source_data']['field_config'] = [
69 'field_name' => 'body',
70 'type' => 'text_with_summary',
73 'storage_type' => 'field_sql_storage',
74 'storage_module' => 'field_sql_storage',
75 'storage_active' => 1,
84 'field_name' => 'title_field',
88 'storage_type' => 'field_sql_storage',
89 'storage_module' => 'field_sql_storage',
90 'storage_active' => 1,
98 $tests[0]['source_data']['field_config_instance'] = [
102 'field_name' => 'body',
103 'entity_type' => 'node',
104 'bundle' => 'article',
111 'field_name' => 'body',
112 'entity_type' => 'node',
120 'field_name' => 'title_field',
121 'entity_type' => 'node',
127 $tests[0]['source_data']['field_revision_body'] = [
129 'entity_type' => 'node',
130 'bundle' => 'article',
136 'body_value' => 'Untranslated body',
137 'body_summary' => 'Untranslated summary',
138 'body_format' => 'filtered_html',
141 'entity_type' => 'node',
148 'body_value' => 'English body',
149 'body_summary' => 'English summary',
150 'body_format' => 'filtered_html',
153 'entity_type' => 'node',
160 'body_value' => 'French body',
161 'body_summary' => 'French summary',
162 'body_format' => 'filtered_html',
165 'entity_type' => 'node',
172 'body_value' => 'Spanish body',
173 'body_summary' => 'Spanish summary',
174 'body_format' => 'filtered_html',
177 $tests[0]['source_data']['field_revision_title_field'] = [
179 'entity_type' => 'node',
183 'revision_id' => '2',
186 'title_field_value' => 'English Source',
187 'title_field_format' => NULL,
190 'entity_type' => 'node',
194 'revision_id' => '2',
197 'title_field_value' => 'French Translation',
198 'title_field_format' => NULL,
201 'entity_type' => 'node',
205 'revision_id' => '2',
208 'title_field_value' => 'Spanish Translation',
209 'title_field_format' => NULL,
212 $tests[0]['source_data']['node'] = [
218 'title' => 'Untranslated article',
221 'created' => 1531343456,
222 'changed' => 1531343456,
234 'title' => 'Translated page',
237 'created' => 1531343528,
238 'changed' => 1531343528,
246 $tests[0]['source_data']['node_revision'] = [
251 'title' => 'Untranslated article',
253 'timestamp' => 1531343456,
263 'title' => 'Translated page',
265 'timestamp' => 1531343528,
272 $tests[0]['source_data']['system'] = [
280 // The expected results.
281 $tests[0]['expected_data'] = [
283 'entity_type' => 'node',
291 'created' => 1531343508,
292 'changed' => 1531343508,
294 'title' => 'French Translation',
298 'timestamp' => 1531343528,
302 'value' => 'French body',
303 'summary' => 'French summary',
304 'format' => 'filtered_html',
309 'entity_type' => 'node',
317 'created' => 1531343528,
318 'changed' => 1531343528,
320 'title' => 'Spanish Translation',
324 'timestamp' => 1531343528,
328 'value' => 'Spanish body',
329 'summary' => 'Spanish summary',
330 'format' => 'filtered_html',
336 // Do an automatic count.
337 $tests[0]['expected_count'] = NULL;
339 // Set up source plugin configuration.
340 $tests[0]['configuration'] = [
341 'node_type' => 'page',
345 $tests[1]['source_data'] = $tests[0]['source_data'];
347 // The expected results.
348 $tests[1]['expected_data'] = [];
350 // Do an automatic count.
351 $tests[1]['expected_count'] = NULL;
353 // Set up source plugin configuration.
354 $tests[1]['configuration'] = [
355 'node_type' => 'article',