Commit db9a8337 authored by catch's avatar catch

Issue #2865497 by quietone, pritish.kumar, Jo Fitzgerald, moshe weitzman,...

Issue #2865497 by quietone, pritish.kumar, Jo Fitzgerald, moshe weitzman, phenaproxima: Fix high-water condition for new migrations
parent 7d0a226b
......@@ -270,7 +270,7 @@ protected function initializeIterator() {
}
// 2. If we are using high water marks, also include rows above the mark.
// But, include all rows if the high water mark is not set.
if ($this->getHighWaterProperty() && ($high_water = $this->getHighWater()) !== '') {
if ($this->getHighWaterProperty() && ($high_water = $this->getHighWater())) {
$high_water_field = $this->getHighWaterField();
$conditions->condition($high_water_field, $high_water, '>');
$this->query->orderBy($high_water_field);
......
......@@ -19,9 +19,9 @@ class HighWaterNotJoinableTest extends MigrateSqlSourceTestBase {
* {@inheritdoc}
*/
public function providerSource() {
$tests = [];
// Test high water when the map is not joinable.
// The source data.
$tests[0]['source_data']['high_water_node'] = [
[
......@@ -64,6 +64,53 @@ public function providerSource() {
],
];
$tests[0]['high_water'] = $tests[0]['source_data']['high_water_node'][0]['changed'];
// Test high water initialized to NULL.
$tests[1]['source_data'] = $tests[0]['source_data'];
$tests[1]['expected_data'] = [
[
'id' => 1,
'title' => 'Item 1',
'changed' => 1,
],
[
'id' => 2,
'title' => 'Item 2',
'changed' => 2,
],
[
'id' => 3,
'title' => 'Item 3',
'changed' => 3,
],
];
$tests[1]['expected_count'] = $tests[0]['expected_count'];
$tests[1]['configuration'] = $tests[0]['configuration'];
$tests[1]['high_water'] = NULL;
// Test high water initialized to an empty string.
$tests[2]['source_data'] = $tests[0]['source_data'];
$tests[2]['expected_data'] = [
[
'id' => 1,
'title' => 'Item 1',
'changed' => 1,
],
[
'id' => 2,
'title' => 'Item 2',
'changed' => 2,
],
[
'id' => 3,
'title' => 'Item 3',
'changed' => 3,
],
];
$tests[2]['expected_count'] = $tests[0]['expected_count'];
$tests[2]['configuration'] = $tests[0]['configuration'];
$tests[2]['high_water'] = '';
return $tests;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment