Further Drupal 8.6.4 changes. Some core files were not committed before a commit...
[yaffs-website] / web / core / modules / node / tests / src / Kernel / Plugin / migrate / source / d6 / NodeRevisionByNodeTypeTest.php
1 <?php
2
3 namespace Drupal\Tests\node\Kernel\Plugin\migrate\source\d6;
4
5 use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
6
7 /**
8  * Tests D6 node revision source plugin.
9  *
10  * @covers \Drupal\node\Plugin\migrate\source\d6\NodeRevision
11  *
12  * @group node
13  */
14 class NodeRevisionByNodeTypeTest extends MigrateSqlSourceTestBase {
15
16   /**
17    * {@inheritdoc}
18    */
19   public static $modules = ['node', 'user', 'migrate_drupal'];
20
21   /**
22    * {@inheritdoc}
23    */
24   public function providerSource() {
25     $tests = [];
26
27     // The source data.
28     $tests[0]['source_data']['node'] = [
29       [
30         'nid' => 1,
31         'type' => 'page',
32         'language' => 'en',
33         'status' => 1,
34         'created' => 1279051598,
35         'changed' => 1279051598,
36         'comment' => 2,
37         'promote' => 1,
38         'moderate' => 0,
39         'sticky' => 0,
40         'tnid' => 0,
41         'translate' => 0,
42         'vid' => 4,
43         'uid' => 1,
44         'title' => 'title for revision 4 (node 1)',
45       ],
46       [
47         'nid' => 2,
48         'type' => 'article',
49         'language' => 'en',
50         'status' => 1,
51         'created' => 1279290908,
52         'changed' => 1279308993,
53         'comment' => 0,
54         'promote' => 1,
55         'moderate' => 0,
56         'sticky' => 0,
57         'tnid' => 0,
58         'translate' => 0,
59         'vid' => 2,
60         'uid' => 1,
61         'title' => 'title for revision 2 (node 2)',
62       ],
63     ];
64     $tests[0]['source_data']['node_revisions'] = [
65       [
66         'nid' => 1,
67         'vid' => 1,
68         'uid' => 1,
69         'title' => 'title for revision 1 (node 1)',
70         'body' => 'body for revision 1 (node 1)',
71         'teaser' => 'teaser for revision 1 (node 1)',
72         'log' => 'log for revision 1 (node 1)',
73         'format' => 1,
74         'timestamp' => 1279051598,
75       ],
76       [
77         'nid' => 1,
78         'vid' => 3,
79         'uid' => 1,
80         'title' => 'title for revision 3 (node 1)',
81         'body' => 'body for revision 3 (node 1)',
82         'teaser' => 'teaser for revision 3 (node 1)',
83         'log' => 'log for revision 3 (node 1)',
84         'format' => 1,
85         'timestamp' => 1279051598,
86       ],
87       [
88         'nid' => 1,
89         'vid' => 4,
90         'uid' => 1,
91         'title' => 'title for revision 4 (node 1)',
92         'body' => 'body for revision 4 (node 1)',
93         'teaser' => 'teaser for revision 4 (node 1)',
94         'log' => 'log for revision 4 (node 1)',
95         'format' => 1,
96         'timestamp' => 1279051598,
97       ],
98       [
99         'nid' => 2,
100         'vid' => 2,
101         'uid' => 1,
102         'title' => 'title for revision 2 (node 2)',
103         'body' => 'body for revision 2 (node 2)',
104         'teaser' => 'teaser for revision 2 (node 2)',
105         'log' => 'log for revision 2 (node 2)',
106         'format' => 1,
107         'timestamp' => 1279308993,
108       ],
109     ];
110
111     // The expected results.
112     // There are three revisions of nid 1; vid 4 is the current one. The
113     // NodeRevision plugin should capture every revision EXCEPT that one.
114     // nid 2 will be ignored because source plugin configuration specifies
115     // a particular node type.
116     $tests[0]['expected_data'] = [
117       [
118         'nid' => 1,
119         'type' => 'page',
120         'language' => 'en',
121         'status' => 1,
122         'created' => 1279051598,
123         'changed' => 1279051598,
124         'comment' => 2,
125         'promote' => 1,
126         'moderate' => 0,
127         'sticky' => 0,
128         'tnid' => 1,
129         'translate' => 0,
130         'vid' => 1,
131         'node_uid' => 1,
132         'revision_uid' => 1,
133         'title' => 'title for revision 1 (node 1)',
134         'body' => 'body for revision 1 (node 1)',
135         'teaser' => 'teaser for revision 1 (node 1)',
136         'log' => 'log for revision 1 (node 1)',
137         'format' => 1,
138       ],
139       [
140         'nid' => 1,
141         'type' => 'page',
142         'language' => 'en',
143         'status' => 1,
144         'created' => 1279051598,
145         'changed' => 1279051598,
146         'comment' => 2,
147         'promote' => 1,
148         'moderate' => 0,
149         'sticky' => 0,
150         'tnid' => 1,
151         'translate' => 0,
152         'vid' => 3,
153         'node_uid' => 1,
154         'revision_uid' => 1,
155         'title' => 'title for revision 3 (node 1)',
156         'body' => 'body for revision 3 (node 1)',
157         'teaser' => 'teaser for revision 3 (node 1)',
158         'log' => 'log for revision 3 (node 1)',
159         'format' => 1,
160       ],
161     ];
162
163     // Do an automatic count.
164     $tests[0]['expected_count'] = NULL;
165
166     // Set up source plugin configuration.
167     $tests[0]['configuration'] = [
168       'node_type' => 'page',
169     ];
170
171     return $tests;
172   }
173
174 }