Skip to content
Snippets Groups Projects
Commit 65239341 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2807939 by erozqba, svendecabooter: Convert System's Migrate source tests to new base class

parent a94bff87
No related branches found
No related tags found
No related merge requests found
<?php
namespace Drupal\Tests\system\Kernel\Plugin\migrate\source;
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
/**
* Tests menu source plugin.
*
* @covers Drupal\system\Plugin\migrate\source\Menu
*
* @group system
*/
class MenuTest extends MigrateSqlSourceTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['system', 'migrate_drupal'];
/**
* {@inheritdoc}
*/
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['menu_custom'] = [
[
'menu_name' => 'menu-name-1',
'title' => 'menu custom value 1',
'description' => 'menu custom description value 1',
],
[
'menu_name' => 'menu-name-2',
'title' => 'menu custom value 2',
'description' => 'menu custom description value 2',
],
];
// The expected results are identical to the source data.
$tests[0]['expected_data'] = $tests[0]['source_data']['menu_custom'];
return $tests;
}
}
<?php
namespace Drupal\Tests\system\Unit\Plugin\migrate\source;
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
/**
* Tests menu source plugin.
*
* @group system
*/
class MenuTest extends MigrateSqlSourceTestCase {
const PLUGIN_CLASS = 'Drupal\system\Plugin\migrate\source\Menu';
protected $migrationConfiguration = array(
'id' => 'test',
'source' => array(
'plugin' => 'menu',
),
);
protected $expectedResults = array(
array(
'menu_name' => 'menu-name-1',
'title' => 'menu custom value 1',
'description' => 'menu custom description value 1',
),
array(
'menu_name' => 'menu-name-2',
'title' => 'menu custom value 2',
'description' => 'menu custom description value 2',
),
);
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->databaseContents['menu_custom'] = $this->expectedResults;
parent::setUp();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment