3 namespace Drupal\Tests\node\Kernel\Plugin\migrate\source\d6;
5 use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
8 * Tests D6 node revision source plugin.
10 * @covers \Drupal\node\Plugin\migrate\source\d6\NodeRevision
14 class NodeRevisionByNodeTypeTest extends MigrateSqlSourceTestBase {
19 public static $modules = ['node', 'user', 'migrate_drupal'];
24 public function providerSource() {
28 $tests[0]['source_data']['node'] = [
34 'created' => 1279051598,
35 'changed' => 1279051598,
44 'title' => 'title for revision 4 (node 1)',
51 'created' => 1279290908,
52 'changed' => 1279308993,
61 'title' => 'title for revision 2 (node 2)',
64 $tests[0]['source_data']['node_revisions'] = [
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)',
74 'timestamp' => 1279051598,
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)',
85 'timestamp' => 1279051598,
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)',
96 'timestamp' => 1279051598,
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)',
107 'timestamp' => 1279308993,
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'] = [
122 'created' => 1279051598,
123 'changed' => 1279051598,
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)',
144 'created' => 1279051598,
145 'changed' => 1279051598,
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)',
163 // Do an automatic count.
164 $tests[0]['expected_count'] = NULL;
166 // Set up source plugin configuration.
167 $tests[0]['configuration'] = [
168 'node_type' => 'page',