function MigrateSourceTest::testNewHighwater

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

Tests that a highwater mark newer than our saved one imports a row.

Throws

\Exception

File

core/modules/migrate/tests/src/Unit/MigrateSourceTest.php, line 271

Class

MigrateSourceTest
@coversDefaultClass \Drupal\migrate\Plugin\migrate\source\SourcePluginBase @group migrate

Namespace

Drupal\Tests\migrate\Unit

Code

public function testNewHighwater() {
    $configuration = [
        'high_water_property' => [
            'name' => 'timestamp',
        ],
    ];
    // Set a highwater property field for source. Now we should have a row
    // because the row timestamp is greater than the current highwater mark.
    $source = $this->getSource($configuration, [], MigrateIdMapInterface::STATUS_IMPORTED, $this->row['timestamp'] - 1);
    $source->rewind();
    $this->assertInstanceOf(Row::class, $source->current());
}

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