View source
<?php
namespace Drupal\Tests\tracker\Kernel\Migrate\d7;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
use Drupal\Core\Database\Database;
class MigrateTrackerNodeTest extends MigrateDrupal7TestBase {
protected static $modules = [
'menu_ui',
'node',
'text',
'tracker',
];
protected function setUp() : void {
parent::setUp();
$this
->installEntitySchema('node');
$this
->installConfig(static::$modules);
$this
->installSchema('node', [
'node_access',
]);
$this
->installSchema('tracker', [
'tracker_node',
'tracker_user',
]);
$this
->migrateContentTypes();
$this
->migrateUsers(FALSE);
$this
->executeMigrations([
'd7_node',
'd7_tracker_node',
]);
}
public function testMigrateTrackerNode() {
$connection = Database::getConnection('default', 'migrate');
$num_rows = $connection
->select('tracker_node', 'tn')
->fields('tn', [
'nid',
'published',
'changed',
])
->countQuery()
->execute()
->fetchField();
$this
->assertSame('1', $num_rows);
$tracker_nodes = $connection
->select('tracker_node', 'tn')
->fields('tn', [
'nid',
'published',
'changed',
])
->execute();
$row = $tracker_nodes
->fetchAssoc();
$this
->assertSame('1', $row['nid']);
$this
->assertSame('1', $row['published']);
$this
->assertSame('1421727536', $row['changed']);
}
}