You are here

public function MigrateSourceTest::testNewHighwater in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate/tests/src/Unit/MigrateSourceTest.php \Drupal\Tests\migrate\Unit\MigrateSourceTest::testNewHighwater()

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

Throws

\Exception

File

core/modules/migrate/tests/src/Unit/MigrateSourceTest.php, line 268
Contains \Drupal\Tests\migrate\Unit\MigrateSourceTest.

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());
}