You are here

public function MigrateSourceTest::testOutdatedHighwater in Zircon Profile 8

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

Test that an outdated highwater mark does not cause a row to be imported.

File

core/modules/migrate/tests/src/Unit/MigrateSourceTest.php, line 200
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 testOutdatedHighwater() {
  $source = $this
    ->getSource([], [], MigrateIdMapInterface::STATUS_IMPORTED);

  // Set the originalHighwater to something higher than our timestamp.
  $this->migration
    ->expects($this
    ->any())
    ->method('getHighwater')
    ->willReturn($this->row['timestamp'] + 1);

  // The current highwater mark is now higher than the row timestamp so no row
  // is expected.
  $source
    ->rewind();
  $this
    ->assertNull($source
    ->current(), 'Original highwater mark is higher than incoming row timestamp.');
}