View source
<?php
namespace Drupal\Tests\node\Kernel\Plugin\migrate\source\d6;
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
class NodeByNodeTypeTest extends MigrateSqlSourceTestBase {
public static $modules = [
'node',
'user',
'migrate_drupal',
];
public function providerSource() {
$tests = [];
$tests[0]['source_data']['node'] = [
[
'nid' => 1,
'vid' => 1,
'type' => 'page',
'language' => 'en',
'title' => 'node title 1',
'uid' => 1,
'status' => 1,
'created' => 1279051598,
'changed' => 1279051598,
'comment' => 2,
'promote' => 1,
'moderate' => 0,
'sticky' => 0,
'tnid' => 1,
'translate' => 0,
],
[
'nid' => 2,
'vid' => 2,
'type' => 'page',
'language' => 'en',
'title' => 'node title 2',
'uid' => 1,
'status' => 1,
'created' => 1279290908,
'changed' => 1279308993,
'comment' => 0,
'promote' => 1,
'moderate' => 0,
'sticky' => 0,
'tnid' => 2,
'translate' => 0,
],
[
'nid' => 5,
'vid' => 5,
'type' => 'article',
'language' => 'en',
'title' => 'node title 5',
'uid' => 1,
'status' => 1,
'created' => 1279290908,
'changed' => 1279308993,
'comment' => 0,
'promote' => 1,
'moderate' => 0,
'sticky' => 0,
'tnid' => 0,
'translate' => 0,
],
];
$tests[0]['source_data']['node_revisions'] = [
[
'nid' => 1,
'vid' => 1,
'title' => 'node title 1',
'uid' => 2,
'timestamp' => 1279051598,
'body' => 'body for node 1',
'teaser' => 'teaser for node 1',
'format' => 1,
'log' => 'log message 1',
],
[
'nid' => 2,
'vid' => 2,
'title' => 'node title 2',
'uid' => 2,
'timestamp' => 1279290908,
'body' => 'body for node 2',
'teaser' => 'teaser for node 2',
'format' => 1,
'log' => 'log message 2',
],
[
'nid' => 5,
'vid' => 5,
'title' => 'node title 5',
'uid' => 2,
'timestamp' => 1279290908,
'body' => 'body for node 5',
'teaser' => 'body for node 5',
'format' => 1,
'log' => 'log message 3',
],
];
$tests[0]['expected_data'] = [
[
'nid' => 1,
'vid' => 1,
'type' => 'page',
'language' => 'en',
'title' => 'node title 1',
'node_uid' => 1,
'revision_uid' => 2,
'status' => 1,
'timestamp' => 1279051598,
'created' => 1279051598,
'changed' => 1279051598,
'comment' => 2,
'promote' => 1,
'moderate' => 0,
'sticky' => 0,
'tnid' => 1,
'translate' => 0,
'body' => 'body for node 1',
'teaser' => 'teaser for node 1',
'format' => 1,
'log' => 'log message 1',
],
[
'nid' => 2,
'vid' => 2,
'type' => 'page',
'language' => 'en',
'title' => 'node title 2',
'node_uid' => 1,
'revision_uid' => 2,
'status' => 1,
'timestamp' => 1279290908,
'created' => 1279290908,
'changed' => 1279308993,
'comment' => 0,
'promote' => 1,
'moderate' => 0,
'sticky' => 0,
'tnid' => 2,
'translate' => 0,
'body' => 'body for node 2',
'teaser' => 'teaser for node 2',
'format' => 1,
'log' => 'log message 2',
],
];
$tests[0]['expected_count'] = NULL;
$tests[0]['configuration'] = [
'node_type' => 'page',
];
return $tests;
}
}