Commit c9f41a1c authored by alexpott's avatar alexpott

Issue #2807913 by quietone, erozqba, Jo Fitzgerald, svendecabooter,...

Issue #2807913 by quietone, erozqba, Jo Fitzgerald, svendecabooter, phenaproxima: Convert Migrate_drupal's Migrate source tests to new base class
parent bd1a9d0d
<?php
namespace Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source;
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
/**
* Tests the variable multirow source plugin.
*
* @covers \Drupal\migrate_drupal\Plugin\migrate\source\VariableMultiRow
*
* @group migrate_drupal
*/
class VariableMultiRowTest extends MigrateSqlSourceTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['migrate_drupal'];
/**
* {@inheritdoc}
*/
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['variable'] = [
['name' => 'foo', 'value' => 'i:1;'],
['name' => 'bar', 'value' => 'b:0;'],
];
// The expected results.
$tests[0]['expected_data'] = [
[
'name' => 'foo',
'value' => 1,
],
[
'name' => 'bar',
'value' => FALSE,
],
];
// The expected count.
$tests[0]['expected_count'] = NULL;
// The source plugin configuration.
$tests[0]['configuration']['variables'] = [
'foo',
'bar',
];
return $tests;
}
}
<?php
namespace Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source;
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
/**
* Tests the variable source plugin.
*
* @covers \Drupal\migrate_drupal\Plugin\migrate\source\Variable
*
* @group migrate_drupal
*/
class VariableTest extends MigrateSqlSourceTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['migrate_drupal'];
/**
* {@inheritdoc}
*/
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['variable'] = [
['name' => 'foo', 'value' => 'i:1;'],
['name' => 'bar', 'value' => 'b:0;'],
];
// The expected results.
$tests[0]['expected_data'] = [
[
'id' => 'foo',
'foo' => 1,
'bar' => FALSE,
],
];
// The expected count.
$tests[0]['expected_count'] = NULL;
// The source plugin configuration.
$tests[0]['configuration']['variables'] = [
'foo',
'bar',
];
return $tests;
}
}
<?php
namespace Drupal\Tests\migrate_drupal\Kernel\Plugin\migrate\source\d6;
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
/**
* Tests the variable source plugin.
*
* @covers \Drupal\migrate_drupal\Plugin\migrate\source\d6\i18nVariable
*
* @group migrate_drupal
*/
class i18nVariableTest extends MigrateSqlSourceTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['migrate_drupal'];
/**
* {@inheritdoc}
*/
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['i18n_variable'] = [
[
'name' => 'site_slogan',
'language' => 'fr',
'value' => 's:19:"Migrate est génial";',
],
[
'name' => 'site_name',
'language' => 'fr',
'value' => 's:11:"nom de site";',
],
[
'name' => 'site_slogan',
'language' => 'mi',
'value' => 's:19:"Ko whakamataku heke";',
],
[
'name' => 'site_name',
'language' => 'mi',
'value' => 's:9:"ingoa_pae";',
],
];
// The expected results.
$tests[0]['expected_data'] = [
[
'language' => 'fr',
'site_slogan' => 'Migrate est génial',
'site_name' => 'nom de site',
],
[
'language' => 'mi',
'site_slogan' => 'Ko whakamataku heke',
'site_name' => 'ingoa_pae',
],
];
// The expected count.
$tests[0]['expected_count'] = NULL;
// The migration configuration.
$tests[0]['configuration']['variables'] = [
'site_slogan',
'site_name',
];
return $tests;
}
}
<?php
namespace Drupal\Tests\migrate_drupal\Unit\source;
/**
* Tests variable multirow source w/ high water handling.
*
* @group migrate_drupal
*/
class VariableMultiRowSourceWithHighwaterTest extends VariableMultiRowTestBase {
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->migrationConfiguration['highWaterProperty']['field'] = 'test';
parent::setup();
}
}
<?php
namespace Drupal\Tests\migrate_drupal\Unit\source;
/**
* Tests D6 variable multirow source plugin.
*
* @group migrate_drupal
*/
class VariableMultiRowTest extends VariableMultiRowTestBase {
}
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