function HighWaterTest::setUp

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

Overrides MigrateTestBase::setUp

File

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

Class

HighWaterTest
Tests migration high water property.

Namespace

Drupal\Tests\migrate\Kernel

Code

protected function setUp() {
    parent::setUp();
    // Create source test table.
    $this->sourceDatabase
        ->schema()
        ->createTable('high_water_node', [
        'fields' => [
            'id' => [
                'description' => 'Serial',
                'type' => 'serial',
                'unsigned' => TRUE,
                'not null' => TRUE,
            ],
            'changed' => [
                'description' => 'Highwater',
                'type' => 'int',
                'unsigned' => TRUE,
            ],
            'title' => [
                'description' => 'Title',
                'type' => 'varchar',
                'length' => 128,
                'not null' => TRUE,
                'default' => '',
            ],
        ],
        'primary key' => [
            'id',
        ],
        'description' => 'Contains nodes to import',
    ]);
    // Add 3 items to source table.
    $this->sourceDatabase
        ->insert('high_water_node')
        ->fields([
        'title',
        'changed',
    ])
        ->values([
        'title' => 'Item 1',
        'changed' => 1,
    ])
        ->values([
        'title' => 'Item 2',
        'changed' => 2,
    ])
        ->values([
        'title' => 'Item 3',
        'changed' => 3,
    ])
        ->execute();
    $this->installEntitySchema('node');
    $this->installEntitySchema('user');
    $this->installSchema('node', 'node_access');
    $this->executeMigration('high_water_test');
}

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