Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / user / tests / src / Kernel / Plugin / migrate / source / d7 / UserTest.php
1 <?php
2
3 namespace Drupal\Tests\user\Kernel\Plugin\migrate\source\d7;
4
5 use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
6
7 /**
8  * Tests the d7_user source plugin.
9  *
10  * @covers \Drupal\user\Plugin\migrate\source\d7\User
11  * @group user
12  */
13 class UserTest extends MigrateSqlSourceTestBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public static $modules = ['user', 'migrate_drupal'];
19
20   /**
21    * {@inheritdoc}
22    */
23   public function providerSource() {
24     $tests = [];
25
26     // The source data.
27     $tests[0]['source_data']['field_config'] = [
28       [
29         'id' => '11',
30         'translatable' => '0',
31       ],
32     ];
33     $tests[0]['source_data']['field_config_instance'] = [
34       [
35         'id' => '33',
36         'field_id' => '11',
37         'field_name' => 'field_file',
38         'entity_type' => 'user',
39         'bundle' => 'user',
40         'data' => 'a:0:{}',
41         'deleted' => '0',
42       ],
43     ];
44     $tests[0]['source_data']['field_data_field_file'] = [
45       [
46         'entity_type' => 'user',
47         'bundle' => 'user',
48         'deleted' => 0,
49         'entity_id' => 2,
50         'revision_id' => NULL,
51         'language' => 'und',
52         'delta' => 0,
53         'field_file_fid' => 99,
54         'field_file_display' => 1,
55         'field_file_description' => 'None',
56       ],
57     ];
58     $tests[0]['source_data']['role'] = [
59       [
60         'rid' => 2,
61         'name' => 'authenticated user',
62         'weight' => 0,
63       ],
64     ];
65     $tests[0]['source_data']['users'] = [
66       [
67         'uid' => '2',
68         'name' => 'Odo',
69         'pass' => '$S$DVpvPItXvnsmF3giVEe7Jy2lG.SCoEs8uKwpHsyPvdeNAaNZYxZ8',
70         'mail' => 'odo@local.host',
71         'theme' => '',
72         'signature' => '',
73         'signature_format' => 'filtered_html',
74         'created' => '1432750741',
75         'access' => '0',
76         'login' => '0',
77         'status' => '1',
78         'timezone' => 'America/Chicago',
79         'language' => '',
80         'picture' => '0',
81         'init' => 'odo@local.host',
82         'data' => 'a:1:{s:7:"contact";i:1;}',
83       ],
84     ];
85     $tests[0]['source_data']['users_roles'] = [
86       [
87         'uid' => 2,
88         'rid' => 2,
89       ],
90     ];
91
92     // The expected results.
93     $tests[0]['expected_data'] = [
94       [
95         'uid' => '2',
96         'name' => 'Odo',
97         'pass' => '$S$DVpvPItXvnsmF3giVEe7Jy2lG.SCoEs8uKwpHsyPvdeNAaNZYxZ8',
98         'mail' => 'odo@local.host',
99         'signature' => '',
100         'signature_format' => 'filtered_html',
101         'created' => '1432750741',
102         'access' => '0',
103         'login' => '0',
104         'status' => '1',
105         'timezone' => 'America/Chicago',
106         'language' => '',
107         'picture' => '0',
108         'init' => 'odo@local.host',
109         'roles' => [2],
110         'data' => [
111           'contact' => 1,
112         ],
113         'field_file' => [
114           [
115             'fid' => 99,
116             'display' => 1,
117             'description' => 'None',
118           ],
119         ],
120       ],
121     ];
122
123     return $tests;
124   }
125
126 }