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

Issue #2807937 by erozqba, svendecabooter, phenaproxima: Convert Shortcut's...

Issue #2807937 by erozqba, svendecabooter, phenaproxima: Convert Shortcut's Migrate source tests to new base class
parent 20303228
No related branches found
No related tags found
No related merge requests found
<?php
namespace Drupal\Tests\shortcut\Kernel\Plugin\migrate\source\d7;
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
/**
* Tests D7 ShortcutSet source plugin.
*
* @covers Drupal\shortcut\Plugin\migrate\source\d7\ShortcutSet
*
* @group shortcut
*/
class ShortcutSetTest extends MigrateSqlSourceTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['shortcut', 'migrate_drupal'];
/**
* {@inheritdoc}
*/
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['shortcut_set'] = [
[
'set_name' => 'shortcut-set-2',
'title' => 'Alternative shortcut set',
],
];
// The expected results are identical to the source data.
$tests[0]['expected_data'] = $tests[0]['source_data']['shortcut_set'];
return $tests;
}
}
<?php
namespace Drupal\Tests\shortcut\Kernel\Plugin\migrate\source\d7;
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
/**
* Tests D7 ShortcutSetUsers source plugin.
*
* @covers Drupal\shortcut\Plugin\migrate\source\d7\ShortcutSetUsers
*
* @group shortcut
*/
class ShortcutSetUsersTest extends MigrateSqlSourceTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['shortcut', 'migrate_drupal'];
/**
* {@inheritdoc}
*/
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['shortcut_set_users'] = [
[
'uid' => '2',
'set_name' => 'shortcut-set-2',
],
];
// The expected results are identical to the source data.
$tests[0]['expected_data'] = $tests[0]['source_data']['shortcut_set_users'];
return $tests;
}
}
<?php
namespace Drupal\Tests\shortcut\Kernel\Plugin\migrate\source\d7;
use Drupal\Tests\migrate\Kernel\MigrateSqlSourceTestBase;
/**
* Tests D7 Shortcut source plugin.
*
* @covers Drupal\shortcut\Plugin\migrate\source\d7\Shortcut
*
* @group shortcut
*/
class ShortcutTest extends MigrateSqlSourceTestBase {
/**
* {@inheritdoc}
*/
public static $modules = ['shortcut', 'migrate_drupal'];
/**
* {@inheritdoc}
*/
public function providerSource() {
$tests = [];
// The source data.
$tests[0]['source_data']['menu_links'] = [
[
'menu_name' => 'shortcut-set-2',
'mlid' => '473',
'plid' => '0',
'link_path' => 'admin/people',
'router_path' => 'admin/people',
'link_title' => 'People',
'options' => 'a:0:{}',
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'expanded' => '0',
'weight' => '-50',
'depth' => '1',
'customized' => '0',
'p1' => '473',
'p2' => '0',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
'updated' => '0',
]
];
// The expected results.
$tests[0]['expected_data'] = [
[
'mlid' => '473',
'menu_name' => 'shortcut-set-2',
'link_path' => 'admin/people',
'link_title' => 'People',
'weight' => '-50',
],
];
return $tests;
}
}
<?php
namespace Drupal\Tests\shortcut\Unit\Plugin\migrate\source\d7;
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
/**
* Tests D7 ShortcutSet source plugin.
*
* @group shortcut
*/
class ShortcutSetTest extends MigrateSqlSourceTestCase {
const PLUGIN_CLASS = 'Drupal\shortcut\Plugin\migrate\source\d7\ShortcutSet';
protected $migrationConfiguration = [
'id' => 'test',
'source' => [
'plugin' => 'd7_shortcut_set',
],
];
protected $expectedResults = [
[
'set_name' => 'shortcut-set-2',
'title' => 'Alternative shortcut set',
],
];
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->databaseContents['shortcut_set'] = $this->expectedResults;
parent::setUp();
}
}
<?php
namespace Drupal\Tests\shortcut\Unit\Plugin\migrate\source\d7;
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
/**
* Tests D7 ShortcutSetUsers source plugin.
*
* @group shortcut
*/
class ShortcutSetUsersTest extends MigrateSqlSourceTestCase {
const PLUGIN_CLASS = 'Drupal\shortcut\Plugin\migrate\source\d7\ShortcutSetUsers';
protected $migrationConfiguration = [
'id' => 'test',
'source' => [
'plugin' => 'd7_shortcut_set_users',
],
];
protected $expectedResults = [
[
'uid' => '2',
'set_name' => 'shortcut-set-2',
],
];
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->databaseContents['shortcut_set_users'] = $this->expectedResults;
parent::setUp();
}
}
<?php
namespace Drupal\Tests\shortcut\Unit\Plugin\migrate\source\d7;
use Drupal\Tests\migrate\Unit\MigrateSqlSourceTestCase;
/**
* Tests D7 Shortcut source plugin.
*
* @group shortcut
*/
class ShortcutTest extends MigrateSqlSourceTestCase {
const PLUGIN_CLASS = 'Drupal\shortcut\Plugin\migrate\source\d7\Shortcut';
protected $migrationConfiguration = [
'id' => 'test',
'source' => [
'plugin' => 'd7_shortcut',
],
];
protected $expectedResults = [
[
'mlid' => '473',
'menu_name' => 'shortcut-set-2',
'link_path' => 'admin/people',
'link_title' => 'People',
'weight' => '-50',
],
];
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->databaseContents['menu_links'][] = [
'menu_name' => 'shortcut-set-2',
'mlid' => '473',
'plid' => '0',
'link_path' => 'admin/people',
'router_path' => 'admin/people',
'link_title' => 'People',
'options' => 'a:0:{}',
'module' => 'menu',
'hidden' => '0',
'external' => '0',
'has_children' => '0',
'expanded' => '0',
'weight' => '-50',
'depth' => '1',
'customized' => '0',
'p1' => '473',
'p2' => '0',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
'updated' => '0',
];
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