Pull merge.
[yaffs-website] / web / core / modules / block / tests / src / Kernel / Plugin / migrate / source / d7 / BlockTranslationTest.php
1 <?php
2
3 namespace Drupal\Tests\block\Kernel\Plugin\migrate\source\d7;
4
5 use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
6
7 /**
8  * Tests i18n block source plugin.
9  *
10  * @covers \Drupal\block\Plugin\migrate\source\d7\BlockTranslation
11  *
12  * @group content_translation
13  */
14 class BlockTranslationTest extends MigrateSqlSourceTestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static $modules = ['block', 'migrate_drupal'];
20
21   /**
22    * {@inheritdoc}
23    */
24   public function providerSource() {
25
26     // The source data.
27     $tests[0]['source_data']['block'] = [
28       [
29         'bid' => 1,
30         'module' => 'system',
31         'delta' => 'main',
32         'theme' => 'bartik',
33         'status' => 1,
34         'weight' => 0,
35         'region' => 'content',
36         'custom' => '0',
37         'visibility' => 0,
38         'pages' => '',
39         'title' => '',
40         'cache' => -1,
41         'i18n_mode' => 0,
42       ],
43       [
44         'bid' => 2,
45         'module' => 'system',
46         'delta' => 'navigation',
47         'theme' => 'bartik',
48         'status' => 1,
49         'weight' => 0,
50         'region' => 'sidebar_first',
51         'custom' => '0',
52         'visibility' => 0,
53         'pages' => '',
54         'title' => 'Navigation',
55         'cache' => -1,
56         'i18n_mode' => 1,
57       ],
58     ];
59     $tests[0]['source_data']['block_role'] = [
60       [
61         'module' => 'block',
62         'delta' => 1,
63         'rid' => 2,
64       ],
65       [
66         'module' => 'block',
67         'delta' => 2,
68         'rid' => 2,
69       ],
70       [
71         'module' => 'block',
72         'delta' => 2,
73         'rid' => 100,
74       ],
75     ];
76     $tests[0]['source_data']['i18n_string'] = [
77       [
78         'lid' => 1,
79         'textgroup' => 'block',
80         'context' => '1',
81         'objectid' => 'navigation',
82         'type' => 'system',
83         'property' => 'title',
84         'objectindex' => 0,
85         'format' => '',
86       ],
87     ];
88
89     $tests[0]['source_data']['locales_target'] = [
90       [
91         'lid' => 1,
92         'translation' => 'fr - Navigation',
93         'language' => 'fr',
94         'plid' => 0,
95         'plural' => 0,
96         'i18n_status' => 0,
97       ],
98     ];
99     $tests[0]['source_data']['role'] = [
100       [
101         'rid' => 2,
102         'name' => 'authenticated user',
103       ],
104     ];
105     $tests[0]['source_data']['system'] = [
106       [
107         'filename' => 'modules/system/system.module',
108         'name' => 'system',
109         'type' => 'module',
110         'owner' => '',
111         'status' => '1',
112         'throttle' => '0',
113         'bootstrap' => '0',
114         'schema_version' => '7055',
115         'weight' => '0',
116         'info' => 'a:0:{}',
117       ],
118     ];
119     // The expected results.
120     $tests[0]['expected_data'] = [
121       [
122         'bid' => 2,
123         'module' => 'system',
124         'delta' => 'navigation',
125         'theme' => 'bartik',
126         'status' => 1,
127         'weight' => 0,
128         'region' => 'sidebar_first',
129         'custom' => '0',
130         'visibility' => 0,
131         'pages' => '',
132         'title' => 'Navigation',
133         'cache' => -1,
134         'i18n_mode' => 1,
135         'lid' => 1,
136         'translation' => 'fr - Navigation',
137         'language' => 'fr',
138         'plid' => 0,
139         'plural' => 0,
140         'i18n_status' => 0,
141       ],
142     ];
143
144     return $tests;
145   }
146
147 }