e54eb6ee3f7c309dd3773d1cef69784d10658df6
[yaffs-website] / web / core / modules / taxonomy / tests / src / Kernel / Plugin / migrate / source / d6 / VocabularyTranslationTest.php
1 <?php
2
3 namespace Drupal\Tests\taxonomy\Kernel\Plugin\migrate\source\d6;
4
5 use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
6
7 /**
8  * Tests D6 i18n vocabulary source plugin.
9  *
10  * @covers \Drupal\taxonomy\Plugin\migrate\source\d6\VocabularyTranslation
11  * @group taxonomy
12  */
13 class VocabularyTranslationTest extends MigrateSqlSourceTestBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public static $modules = ['taxonomy', 'migrate_drupal'];
19
20   /**
21    * {@inheritdoc}
22    */
23   public function providerSource() {
24     $tests = [];
25
26     // The source data.
27     $tests[0][0]['i18n_strings'] = [
28       [
29         'lid' => 1,
30         'objectid' => 1,
31         'type' => 'vocabulary',
32         'property' => 'name',
33         'objectindex' => 1,
34         'format' => 0,
35       ],
36       [
37         'lid' => 2,
38         'objectid' => 2,
39         'type' => 'vocabulary',
40         'property' => 'name',
41         'objectindex' => 2,
42         'format' => 0,
43       ],
44     ];
45
46     $tests[0][0]['locales_target'] = [
47       [
48         'lid' => 1,
49         'language' => 'fr',
50         'translation' => 'fr - vocabulary 1',
51         'plid' => 0,
52         'plural' => 0,
53         'i18n_status' => 0,
54       ],
55       [
56         'lid' => 2,
57         'language' => 'fr',
58         'translation' => 'fr - vocabulary 2',
59         'plid' => 0,
60         'plural' => 0,
61         'i18n_status' => 0,
62       ],
63     ];
64
65     $tests[0][0]['vocabulary'] = [
66       [
67         'vid' => 1,
68         'name' => 'vocabulary 1',
69         'description' => 'description of vocabulary 1',
70         'help' => 1,
71         'relations' => 1,
72         'hierarchy' => 1,
73         'multiple' => 0,
74         'required' => 0,
75         'tags' => 0,
76         'module' => 'taxonomy',
77         'weight' => 4,
78         'language' => '',
79       ],
80       [
81         'vid' => 2,
82         'name' => 'vocabulary 2',
83         'description' => 'description of vocabulary 2',
84         'help' => 1,
85         'relations' => 1,
86         'hierarchy' => 1,
87         'multiple' => 0,
88         'required' => 0,
89         'tags' => 0,
90         'module' => 'taxonomy',
91         'weight' => 5,
92         'language' => '',
93       ],
94     ];
95
96     $tests[0]['expected_results'] = [
97       [
98         'vid' => 1,
99         'name' => 'vocabulary 1',
100         'description' => 'description of vocabulary 1',
101         'lid' => '1',
102         'type' => 'vocabulary',
103         'property' => 'name',
104         'objectid' => '1',
105         'lt_lid' => '1',
106         'translation' => 'fr - vocabulary 1',
107         'language' => 'fr',
108       ],
109       [
110         'vid' => 2,
111         'name' => 'vocabulary 2',
112         'description' => 'description of vocabulary 2',
113         'lid' => '2',
114         'type' => 'vocabulary',
115         'property' => 'name',
116         'objectid' => '2',
117         'lt_lid' => '2',
118         'translation' => 'fr - vocabulary 2',
119         'language' => 'fr',
120       ],
121     ];
122     return $tests;
123   }
124
125 }