Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / block / tests / src / Kernel / Plugin / migrate / source / BlockTest.php
1 <?php
2
3 namespace Drupal\Tests\block\Kernel\Plugin\migrate\source;
4
5 use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
6
7 /**
8  * Tests block source plugin.
9  *
10  * @covers \Drupal\block\Plugin\migrate\source\Block
11  * @group block
12  */
13 class BlockTest extends MigrateSqlSourceTestBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public static $modules = ['block', 'migrate_drupal'];
19
20   /**
21    * {@inheritdoc}
22    */
23   public function providerSource() {
24     $tests = [];
25
26     // The source data.
27     $tests[0]['source_data']['blocks'] = [
28       [
29         'bid' => 1,
30         'module' => 'block',
31         'delta' => '1',
32         'theme' => 'garland',
33         'status' => 1,
34         'weight' => 0,
35         'region' => 'left',
36         'visibility' => 0,
37         'pages' => '',
38         'title' => 'Test Title 01',
39         'cache' => -1,
40       ],
41       [
42         'bid' => 2,
43         'module' => 'block',
44         'delta' => '2',
45         'theme' => 'garland',
46         'status' => 1,
47         'weight' => 5,
48         'region' => 'right',
49         'visibility' => 0,
50         'pages' => '<front>',
51         'title' => 'Test Title 02',
52         'cache' => -1,
53       ],
54     ];
55     $tests[0]['source_data']['blocks_roles'] = [
56       [
57         'module' => 'block',
58         'delta' => 1,
59         'rid' => 2,
60       ],
61       [
62         'module' => 'block',
63         'delta' => 2,
64         'rid' => 2,
65       ],
66       [
67         'module' => 'block',
68         'delta' => 2,
69         'rid' => 100,
70       ],
71     ];
72     $tests[0]['source_data']['role'] = [
73       [
74         'rid' => 2,
75         'name' => 'authenticated user',
76       ],
77     ];
78     $tests[0]['source_data']['system'] = [
79       [
80         'filename' => 'modules/system/system.module',
81         'name' => 'system',
82         'type' => 'module',
83         'owner' => '',
84         'status' => '1',
85         'throttle' => '0',
86         'bootstrap' => '0',
87         'schema_version' => '6055',
88         'weight' => '0',
89         'info' => 'a:0:{}',
90       ],
91     ];
92
93     // The expected results.
94     $tests[0]['expected_data'] = [
95       [
96         'bid' => 1,
97         'module' => 'block',
98         'delta' => '1',
99         'theme' => 'garland',
100         'status' => 1,
101         'weight' => 0,
102         'region' => 'left',
103         'visibility' => 0,
104         'pages' => '',
105         'title' => 'Test Title 01',
106         'cache' => -1,
107         'roles' => [2],
108       ],
109       [
110         'bid' => 2,
111         'module' => 'block',
112         'delta' => '2',
113         'theme' => 'garland',
114         'status' => 1,
115         'weight' => 5,
116         'region' => 'right',
117         'visibility' => 0,
118         'pages' => '<front>',
119         'title' => 'Test Title 02',
120         'cache' => -1,
121         'roles' => [2],
122       ],
123     ];
124     return $tests;
125   }
126
127 }