Commit 2df2354f authored by webchick's avatar webchick

Issue #3096969 by quietone, gabesullice, Wim Leers, mikelutz: migrate_drupal's...

Issue #3096969 by quietone, gabesullice, Wim Leers, mikelutz: migrate_drupal's Variable source plugin always returns a row for processing, even if none of the variables for a migration are set on the source site

(cherry picked from commit fb65f06c)
parent 8b099542
......@@ -60,7 +60,8 @@ protected function values() {
* {@inheritdoc}
*/
public function count($refresh = FALSE) {
return intval($this->query()->countQuery()->execute()->fetchField() > 0);
// Variable always returns a single row with at minimum an 'id' property.
return 1;
}
/**
......
......@@ -48,6 +48,42 @@ public function providerSource() {
'bar',
];
// Tests getting one of two variables.
$tests[1]['source_data']['variable'] = [
['name' => 'foo', 'value' => 'i:1;'],
['name' => 'bar', 'value' => 'b:0;'],
];
$tests[1]['expected_data'] = [
[
'id' => 'foo',
'foo' => 1,
],
];
$tests[1]['expected_count'] = NULL;
$tests[1]['configuration']['variables'] = [
'foo',
'bar0',
];
// Tests requesting mis-spelled variable names.
$tests[2]['source_data']['variable'] = [
['name' => 'foo', 'value' => 'i:1;'],
['name' => 'bar', 'value' => 'b:0;'],
];
$tests[2]['expected_data'] = [
[
'id' => 'foo0',
],
];
$tests[2]['expected_count'] = NULL;
$tests[2]['configuration']['variables'] = [
'foo0',
'bar0',
];
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