MigrateTrackerNodeTest.php

Same filename in other branches
  1. 9 core/modules/tracker/tests/src/Kernel/Migrate/d7/MigrateTrackerNodeTest.php
  2. 10 core/modules/tracker/tests/src/Kernel/Migrate/d7/MigrateTrackerNodeTest.php
  3. 11.x core/modules/tracker/tests/src/Kernel/Migrate/d7/MigrateTrackerNodeTest.php

Namespace

Drupal\Tests\tracker\Kernel\Migrate\d7

File

core/modules/tracker/tests/src/Kernel/Migrate/d7/MigrateTrackerNodeTest.php

View source
<?php

namespace Drupal\Tests\tracker\Kernel\Migrate\d7;

use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
use Drupal\Core\Database\Database;

/**
 * Tests migration of tracker_node.
 *
 * @group tracker
 */
class MigrateTrackerNodeTest extends MigrateDrupal7TestBase {
    
    /**
     * {@inheritdoc}
     */
    public static $modules = [
        'menu_ui',
        'node',
        'text',
        'tracker',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() {
        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',
        ]);
    }
    
    /**
     * Tests migration of tracker node table.
     */
    public function testMigrateTrackerNode() {
        $connection = Database::getConnection('default', 'migrate');
        $num_rows = $connection->select('tracker_node', 'tn')
            ->fields('tn', [
            'nid',
            'published',
            'changed',
        ])
            ->countQuery()
            ->execute()
            ->fetchField();
        $this->assertIdentical('1', $num_rows);
        $tracker_nodes = $connection->select('tracker_node', 'tn')
            ->fields('tn', [
            'nid',
            'published',
            'changed',
        ])
            ->execute();
        $row = $tracker_nodes->fetchAssoc();
        $this->assertIdentical('1', $row['nid']);
        $this->assertIdentical('1', $row['published']);
        $this->assertIdentical('1421727536', $row['changed']);
    }

}

Classes

Title Deprecated Summary
MigrateTrackerNodeTest Tests migration of tracker_node.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.