3 namespace Drupal\Tests\comment\Kernel\Plugin\migrate\source\d7;
5 use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
8 * Tests D7 comment entity translation source plugin.
10 * @covers \Drupal\comment\Plugin\migrate\source\d7\CommentEntityTranslation
13 class CommentEntityTranslationTest extends MigrateSqlSourceTestBase {
18 public static $modules = ['comment', 'migrate_drupal'];
23 public function providerSource() {
27 $tests[0]['source_data']['comment'] = [
33 'subject' => 'A comment',
35 'created' => '1421727536',
36 'changed' => '1421727536',
45 $tests[0]['source_data']['entity_translation'] = [
47 'entity_type' => 'comment',
55 'created' => '1421727536',
56 'changed' => '1421727536',
59 'entity_type' => 'comment',
67 'created' => 1531343508,
68 'changed' => 1531343508,
71 'entity_type' => 'comment',
79 'created' => 1531343528,
80 'changed' => 1531343528,
83 $tests[0]['source_data']['field_config'] = [
86 'field_name' => 'field_test',
90 'storage_type' => 'field_sql_storage',
91 'storage_module' => 'field_sql_storage',
92 'storage_active' => 1,
101 'field_name' => 'subject_field',
105 'storage_type' => 'field_sql_storage',
106 'storage_module' => 'field_sql_storage',
107 'storage_active' => 1,
115 $tests[0]['source_data']['field_config_instance'] = [
119 'field_name' => 'field_test',
120 'entity_type' => 'comment',
121 'bundle' => 'comment_node_test_content_type',
128 'field_name' => 'subject_field',
129 'entity_type' => 'comment',
130 'bundle' => 'comment_node_test_content_type',
135 $tests[0]['source_data']['field_data_field_test'] = [
137 'entity_type' => 'comment',
138 'bundle' => 'comment_node_test_content_type',
141 'revision_id' => '1',
144 'field_test_value' => 'This is an English comment',
145 'field_test_format' => NULL,
148 'entity_type' => 'comment',
149 'bundle' => 'comment_node_test_content_type',
152 'revision_id' => '1',
155 'field_test_value' => 'This is a French comment',
156 'field_test_format' => NULL,
159 'entity_type' => 'comment',
160 'bundle' => 'comment_node_test_content_type',
163 'revision_id' => '1',
166 'field_test_value' => 'This is a Spanish comment',
167 'field_test_format' => NULL,
170 $tests[0]['source_data']['field_data_subject_field'] = [
172 'entity_type' => 'comment',
173 'bundle' => 'comment_node_test_content_type',
176 'revision_id' => '1',
179 'subject_field_value' => 'Comment subject in English',
180 'subject_field_format' => NULL,
183 'entity_type' => 'comment',
184 'bundle' => 'comment_node_test_content_type',
187 'revision_id' => '1',
190 'subject_field_value' => 'Comment subject in French',
191 'subject_field_format' => NULL,
194 'entity_type' => 'comment',
195 'bundle' => 'comment_node_test_content_type',
198 'revision_id' => '1',
201 'subject_field_value' => 'Comment subject in Spanish',
202 'subject_field_format' => NULL,
205 $tests[0]['source_data']['node'] = [
209 'type' => 'test_content_type',
214 'created' => '1421727515',
215 'changed' => '1421727515',
224 // The expected results.
225 $tests[0]['expected_data'] = [
227 'subject' => 'A comment',
228 'entity_type' => 'comment',
230 'revision_id' => '1',
236 'created' => '1531343508',
237 'changed' => '1531343508',
240 'value' => 'This is a French comment',
246 'value' => 'Comment subject in French',
252 'subject' => 'A comment',
253 'entity_type' => 'comment',
255 'revision_id' => '1',
261 'created' => '1531343528',
262 'changed' => '1531343528',
265 'value' => 'This is a Spanish comment',
271 'value' => 'Comment subject in Spanish',