function SqlBaseTest::testHighWater

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

Tests that SqlBase respects high-water values.

@dataProvider highWaterDataProvider

Parameters

mixed $high_water: (optional) The high-water value to set.

array $query_result: (optional) The expected query results.

File

core/modules/migrate/tests/src/Kernel/SqlBaseTest.php, line 141

Class

SqlBaseTest
Tests the functionality of SqlBase.

Namespace

Drupal\Tests\migrate\Kernel

Code

public function testHighWater($high_water = NULL, array $query_result = []) {
    $configuration = [
        'high_water_property' => [
            'name' => 'order',
        ],
    ];
    $source = new TestSqlBase($configuration, $this->migration);
    if ($high_water) {
        \Drupal::keyValue('migrate:high_water')->set($this->migration
            ->id(), $high_water);
    }
    $statement = $this->createMock(StatementInterface::class);
    $statement->expects($this->atLeastOnce())
        ->method('setFetchMode')
        ->with(\PDO::FETCH_ASSOC);
    $query = $this->createMock(SelectInterface::class);
    $query->method('execute')
        ->willReturn($statement);
    $query->expects($this->atLeastOnce())
        ->method('orderBy')
        ->with('order', 'ASC');
    $condition_group = $this->createMock(ConditionInterface::class);
    $query->method('orConditionGroup')
        ->willReturn($condition_group);
    $source->setQuery($query);
    $source->rewind();
}

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