public function SqlBaseTest::testHighWater in Drupal 8
Same name and namespace in other branches
- 9 core/modules/migrate/tests/src/Kernel/SqlBaseTest.php \Drupal\Tests\migrate\Kernel\SqlBaseTest::testHighWater()
- 10 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 - Contains \Drupal\Tests\migrate\Kernel\SqlBaseTest.
Class
- SqlBaseTest
- Tests the functionality of SqlBase.
Namespace
Drupal\Tests\migrate\KernelCode
public function testHighWater($high_water = NULL, array $query_result = []) {
$configuration = [
'high_water_property' => [
'name' => 'order',
],
];
$source = new TestSqlBase($configuration, $this->migration);
if ($high_water) {
$source
->getHighWaterStorage()
->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();
}