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
parent
92a0b41fa2
commit
fb65f06c61
|
@ -60,7 +60,8 @@ class Variable extends DrupalSqlBase {
|
|||
* {@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 @@ class VariableTest extends MigrateSqlSourceTestBase {
|
|||
'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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue