function TrackChangesTest::setUp

Same name in other branches
  1. 8.9.x core/modules/migrate/tests/src/Kernel/TrackChangesTest.php \Drupal\Tests\migrate\Kernel\TrackChangesTest::setUp()
  2. 10 core/modules/migrate/tests/src/Kernel/TrackChangesTest.php \Drupal\Tests\migrate\Kernel\TrackChangesTest::setUp()
  3. 11.x core/modules/migrate/tests/src/Kernel/TrackChangesTest.php \Drupal\Tests\migrate\Kernel\TrackChangesTest::setUp()

Overrides MigrateTestBase::setUp

File

core/modules/migrate/tests/src/Kernel/TrackChangesTest.php, line 27

Class

TrackChangesTest
Tests migration track changes property.

Namespace

Drupal\Tests\migrate\Kernel

Code

protected function setUp() : void {
    parent::setUp();
    // Create source test table.
    $this->sourceDatabase
        ->schema()
        ->createTable('track_changes_term', [
        'fields' => [
            'tid' => [
                'description' => 'Serial',
                'type' => 'serial',
                'unsigned' => TRUE,
                'not null' => TRUE,
            ],
            'name' => [
                'description' => 'Name',
                'type' => 'varchar',
                'length' => 128,
                'not null' => TRUE,
                'default' => '',
            ],
            'description' => [
                'description' => 'Name',
                'type' => 'varchar',
                'length' => 255,
                'not null' => FALSE,
                'default' => '',
            ],
        ],
        'primary key' => [
            'tid',
        ],
        'description' => 'Contains taxonomy terms to import',
    ]);
    // Add 4 items to source table.
    $this->sourceDatabase
        ->insert('track_changes_term')
        ->fields([
        'name',
        'description',
    ])
        ->values([
        'name' => 'Item 1',
        'description' => 'Text item 1',
    ])
        ->values([
        'name' => 'Item 2',
        'description' => 'Text item 2',
    ])
        ->values([
        'name' => 'Item 3',
        'description' => 'Text item 3',
    ])
        ->values([
        'name' => 'Item 4',
        'description' => 'Text item 4',
    ])
        ->execute();
    $this->installEntitySchema('taxonomy_term');
    $this->installEntitySchema('user');
    $this->executeMigration('track_changes_test');
}

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