View source
<?php
namespace Drupal\Tests\migrate\Kernel;
class HighWaterNotJoinableTest extends MigrateSqlSourceTestBase {
protected static $modules = [
'migrate',
'migrate_drupal',
'migrate_high_water_test',
];
public function providerSource() {
$tests = [];
$tests[0]['source_data']['high_water_node'] = [
[
'id' => 1,
'title' => 'Item 1',
'changed' => 1,
],
[
'id' => 2,
'title' => 'Item 2',
'changed' => 2,
],
[
'id' => 3,
'title' => 'Item 3',
'changed' => 3,
],
];
$tests[0]['expected_data'] = [
[
'id' => 2,
'title' => 'Item 2',
'changed' => 2,
],
[
'id' => 3,
'title' => 'Item 3',
'changed' => 3,
],
];
$tests[0]['expected_count'] = 3;
$tests[0]['configuration'] = [
'high_water_property' => [
'name' => 'changed',
],
];
$tests[0]['high_water'] = $tests[0]['source_data']['high_water_node'][0]['changed'];
$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;
$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;
}
}