Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / block_content / tests / src / Kernel / Plugin / migrate / source / d7 / BlockCustomTranslationTest.php
1 <?php
2
3 namespace Drupal\Tests\block_content\Kernel\Plugin\migrate\source\d7;
4
5 use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
6
7 /**
8  * Tests i18n custom block translations source plugin.
9  *
10  * @covers \Drupal\block_content\Plugin\migrate\source\d7\BlockCustomTranslation
11  *
12  * @group content_translation
13  */
14 class BlockCustomTranslationTest extends MigrateSqlSourceTestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static $modules = ['block_content', 'migrate_drupal'];
20
21   /**
22    * {@inheritdoc}
23    */
24   public function providerSource() {
25     $tests = [];
26
27     // The source data.
28     $tests[0]['database']['block_custom'] = [
29       [
30         'bid' => 1,
31         'body' => 'box 1 body',
32         'info' => 'box 1 title',
33         'format' => '2',
34       ],
35       [
36         'bid' => 2,
37         'body' => 'box 2 body',
38         'info' => 'box 2 title',
39         'format' => '2',
40       ],
41     ];
42
43     $tests[0]['database']['i18n_string'] = [
44       [
45         'lid' => 1,
46         'objectid' => 1,
47         'type' => 'block',
48         'property' => 'title',
49         'objectindex' => 1,
50         'format' => 0,
51       ],
52       [
53         'lid' => 2,
54         'objectid' => 1,
55         'type' => 'block',
56         'property' => 'body',
57         'objectindex' => 1,
58         'format' => 0,
59       ],
60       [
61         'lid' => 3,
62         'objectid' => 2,
63         'type' => 'block',
64         'property' => 'body',
65         'objectindex' => 2,
66         'format' => 2,
67       ],
68     ];
69
70     $tests[0]['database']['locales_target'] = [
71       [
72         'lid' => 1,
73         'language' => 'fr',
74         'translation' => 'fr - title translation',
75         'plid' => 0,
76         'plural' => 0,
77         'i18n_status' => 0,
78       ],
79       [
80         'lid' => 2,
81         'language' => 'fr',
82         'translation' => 'fr - body translation',
83         'plid' => 0,
84         'plural' => 0,
85         'i18n_status' => 0,
86       ],
87       [
88         'lid' => 3,
89         'language' => 'zu',
90         'translation' => 'zu - body translation',
91         'plid' => 0,
92         'plural' => 0,
93         'i18n_status' => 0,
94       ],
95     ];
96
97     $tests[0]['database']['system'] = [
98       [
99         'type' => 'module',
100         'name' => 'system',
101         'schema_version' => '7001',
102         'status' => '1',
103       ],
104     ];
105
106     $tests[0]['expected_results'] = [
107       [
108         'lid' => '1',
109         'property' => 'title',
110         'language' => 'fr',
111         'translation' => 'fr - title translation',
112         'bid' => '1',
113         'format' => '2',
114         'title_translated' => 'fr - title translation',
115         'body_translated' => 'fr - body translation',
116         'title' => 'box 1 title',
117         'body' => 'box 1 body',
118       ],
119       [
120         'lid' => '2',
121         'property' => 'body',
122         'language' => 'fr',
123         'translation' => 'fr - body translation',
124         'bid' => '1',
125         'format' => '2',
126         'title_translated' => 'fr - title translation',
127         'body_translated' => 'fr - body translation',
128         'title' => 'box 1 title',
129         'body' => 'box 1 body',
130       ],
131       [
132         'lid' => '3',
133         'property' => 'body',
134         'language' => 'zu',
135         'translation' => 'zu - body translation',
136         'bid' => '2',
137         'format' => '2',
138         'title_translated' => NULL,
139         'body_translated' => 'zu - body translation',
140         'title' => 'box 2 title',
141         'body' => 'box 2 body',
142       ],
143     ];
144
145     return $tests;
146   }
147
148 }