Commit 0ce44011 authored by xjm's avatar xjm

Issue #2848364 by Jo Fitzgerald, quietone: Convert Languages's Migrate source...

Issue #2848364 by Jo Fitzgerald, quietone: Convert Languages's Migrate source test to new base class
parent 2a55d2d9
<?php
namespace Drupal\Tests\language\Unit\Migrate;
namespace Drupal\Tests\language\Kernel\Plugin\migrate\source;
use Drupal\language\Plugin\migrate\source\Language;
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
/**
* @coversDefaultClass \Drupal\language\Plugin\migrate\source\Language
* Tests the language source plugin.
*
* @covers \Drupal\language\Plugin\migrate\source\Language
* @group language
*/
class LanguageTest extends MigrateSqlSourceTestCase {
class LanguageTest extends MigrateSqlSourceTestBase {
const PLUGIN_CLASS = Language::class;
/**
* {@inheritdoc}
*/
public static $modules = ['language', 'migrate_drupal'];
protected $migrationConfiguration = array(
'id' => 'test',
'source' => array(
'plugin' => 'language',
),
);
/**
* {@inheritdoc}
*/
public function providerSource() {
$tests = [];
protected $databaseContents = array(
'languages' => array(
array(
// The source data.
$tests[0]['source_data']['languages'] = [
[
'language' => 'en',
'name' => 'English',
'native' => 'English',
......@@ -34,8 +37,8 @@ class LanguageTest extends MigrateSqlSourceTestCase {
'prefix' => '',
'weight' => '0',
'javascript' => '',
),
array(
],
[
'language' => 'fr',
'name' => 'French',
'native' => 'Français',
......@@ -47,37 +50,40 @@ class LanguageTest extends MigrateSqlSourceTestCase {
'prefix' => 'fr',
'weight' => '0',
'javascript' => '',
),
),
);
],
];
protected $expectedResults = array(
array(
'language' => 'en',
'name' => 'English',
'native' => 'English',
'direction' => '0',
'enabled' => '1',
'plurals' => '0',
'formula' => '',
'domain' => '',
'prefix' => '',
'weight' => '0',
'javascript' => '',
),
array(
'language' => 'fr',
'name' => 'French',
'native' => 'Français',
'direction' => '0',
'enabled' => '0',
'plurals' => '2',
'formula' => '($n>1)',
'domain' => '',
'prefix' => 'fr',
'weight' => '0',
'javascript' => '',
),
);
// The expected results.
$tests[0]['expected_data'] = [
[
'language' => 'en',
'name' => 'English',
'native' => 'English',
'direction' => '0',
'enabled' => '1',
'plurals' => '0',
'formula' => '',
'domain' => '',
'prefix' => '',
'weight' => '0',
'javascript' => '',
],
[
'language' => 'fr',
'name' => 'French',
'native' => 'Français',
'direction' => '0',
'enabled' => '0',
'plurals' => '2',
'formula' => '($n>1)',
'domain' => '',
'prefix' => 'fr',
'weight' => '0',
'javascript' => '',
],
];
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