Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / taxonomy / tests / src / Kernel / Plugin / migrate / source / d6 / TermTranslationTest.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 taxonomy term source plugin.
9  *
10  * @covers \Drupal\taxonomy\Plugin\migrate\source\d6\Term
11  * @group taxonomy
12  */
13 class TermTranslationTest 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]['source_data']['term_data'] = [
28       [
29         'tid' => 1,
30         'vid' => 5,
31         'name' => 'name value 1',
32         'description' => 'description value 1',
33         'weight' => 0,
34         'language' => NULL,
35         'trid' => 0,
36       ],
37       [
38         'tid' => 2,
39         'vid' => 6,
40         'name' => 'name value 2',
41         'description' => 'description value 2',
42         'weight' => 0,
43         'language' => NULL,
44         'trid' => 0,
45       ],
46       [
47         'tid' => 3,
48         'vid' => 6,
49         'name' => 'name value 3',
50         'description' => 'description value 3',
51         'weight' => 0,
52         'language' => NULL,
53         'trid' => 0,
54       ],
55       [
56         'tid' => 4,
57         'vid' => 5,
58         'name' => 'name value 4',
59         'description' => 'description value 4',
60         'weight' => 1,
61         'language' => NULL,
62         'trid' => 0,
63       ],
64       [
65         'tid' => 5,
66         'vid' => 6,
67         'name' => 'name value 5',
68         'description' => 'description value 5',
69         'weight' => 1,
70         'language' => NULL,
71         'trid' => 0,
72       ],
73       [
74         'tid' => 6,
75         'vid' => 6,
76         'name' => 'name value 6',
77         'description' => 'description value 6',
78         'weight' => 0,
79         'language' => NULL,
80         'trid' => 0,
81       ],
82       [
83         'tid' => 10,
84         'vid' => 6,
85         'name' => 'zu - name value 2',
86         'description' => 'zu - description value 2',
87         'weight' => 0,
88         'language' => 'zu',
89         'trid' => 0,
90       ],
91     ];
92     $tests[0]['source_data']['term_hierarchy'] = [
93       [
94         'tid' => 1,
95         'parent' => 0,
96       ],
97       [
98         'tid' => 2,
99         'parent' => 0,
100       ],
101       [
102         'tid' => 3,
103         'parent' => 0,
104       ],
105       [
106         'tid' => 4,
107         'parent' => 1,
108       ],
109       [
110         'tid' => 5,
111         'parent' => 2,
112       ],
113       [
114         'tid' => 6,
115         'parent' => 3,
116       ],
117       [
118         'tid' => 6,
119         'parent' => 2,
120       ],
121       [
122         'tid' => 10,
123         'parent' => 0,
124       ],
125     ];
126
127     // The expected results.
128     $tests[0]['expected_data'] = [
129       [
130         'tid' => 1,
131         'vid' => 5,
132         'name' => 'name value 1',
133         'description' => 'description value 1',
134         'weight' => 0,
135         'parent' => [0],
136         'language' => NULL,
137         'trid' => 0,
138       ],
139       [
140         'tid' => 10,
141         'vid' => 6,
142         'name' => 'zu - name value 2',
143         'description' => 'zu - description value 2',
144         'weight' => 0,
145         'parent' => [0],
146         'language' => 'zu',
147         'trid' => 0,
148       ],
149       [
150         'tid' => 2,
151         'vid' => 6,
152         'name' => 'name value 2',
153         'description' => 'description value 2',
154         'weight' => 0,
155         'parent' => [0],
156         'language' => NULL,
157         'trid' => 0,
158       ],
159       [
160         'tid' => 3,
161         'vid' => 6,
162         'name' => 'name value 3',
163         'description' => 'description value 3',
164         'weight' => 0,
165         'parent' => [0],
166         'language' => NULL,
167         'trid' => 0,
168       ],
169       [
170         'tid' => 4,
171         'vid' => 5,
172         'name' => 'name value 4',
173         'description' => 'description value 4',
174         'weight' => 1,
175         'parent' => [1],
176         'language' => NULL,
177         'trid' => 0,
178       ],
179       [
180         'tid' => 5,
181         'vid' => 6,
182         'name' => 'name value 5',
183         'description' => 'description value 5',
184         'weight' => 1,
185         'parent' => [2],
186         'language' => NULL,
187         'trid' => 0,
188       ],
189       [
190         'tid' => 6,
191         'vid' => 6,
192         'name' => 'name value 6',
193         'description' => 'description value 6',
194         'weight' => 0,
195         'parent' => [3, 2],
196         'language' => NULL,
197         'trid' => 0,
198       ],
199     ];
200
201     $tests[0]['expected_count'] = NULL;
202
203     return $tests;
204   }
205
206 }