Update to Drupal 8.2.5. For more information, see https://www.drupal.org/project/drupal/releases/8.2.5
This commit is contained in:
parent
8544b60b39
commit
db56c09587
86 changed files with 2413 additions and 488 deletions
|
|
@ -5,6 +5,7 @@ namespace Drupal\Tests\menu_link_content\Kernel\Migrate\d7;
|
|||
use Drupal\Core\Menu\MenuTreeParameters;
|
||||
use Drupal\menu_link_content\Entity\MenuLinkContent;
|
||||
use Drupal\menu_link_content\MenuLinkContentInterface;
|
||||
use Drupal\node\Entity\Node;
|
||||
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
|
||||
|
||||
/**
|
||||
|
|
@ -18,7 +19,7 @@ class MigrateMenuLinkTest extends MigrateDrupal7TestBase {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = array('link', 'menu_ui', 'menu_link_content');
|
||||
public static $modules = array('link', 'menu_ui', 'menu_link_content', 'node');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
@ -26,6 +27,13 @@ class MigrateMenuLinkTest extends MigrateDrupal7TestBase {
|
|||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('menu_link_content');
|
||||
$this->installEntitySchema('node');
|
||||
$node = Node::create([
|
||||
'nid' => 3,
|
||||
'title' => 'node link test',
|
||||
'type' => 'article',
|
||||
]);
|
||||
$node->save();
|
||||
$this->executeMigrations(['d7_menu', 'd7_menu_links']);
|
||||
\Drupal::service('router.builder')->rebuild();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,10 @@ class LinkUriTest extends UnitTestCase {
|
|||
$expected = 'internal:/test';
|
||||
$tests['without_scheme'] = [$value, $expected];
|
||||
|
||||
$value = ['<front>'];
|
||||
$expected = 'internal:/';
|
||||
$tests['front'] = [$value, $expected];
|
||||
|
||||
$url = Url::fromRoute('route_name');
|
||||
$tests['with_route'] = [$value, $expected, $url];
|
||||
|
||||
|
|
|
|||
|
|
@ -1,73 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\menu_link_content\Unit\Plugin\migrate\process\d7;
|
||||
|
||||
use Drupal\menu_link_content\Plugin\migrate\process\d7\InternalUri;
|
||||
use Drupal\migrate\MigrateExecutableInterface;
|
||||
use Drupal\migrate\Row;
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
|
||||
/**
|
||||
* Tests \Drupal\menu_link_content\Plugin\migrate\process\d7\InternalUri.
|
||||
*
|
||||
* @group menu_link_content
|
||||
*
|
||||
* @coversDefaultClass \Drupal\menu_link_content\Plugin\migrate\process\d7\InternalUri
|
||||
*/
|
||||
class InternalUriTest extends UnitTestCase {
|
||||
|
||||
/**
|
||||
* The 'd7_internal_uri' process plugin being tested.
|
||||
*
|
||||
* @var \Drupal\menu_link_content\Plugin\migrate\process\d7\InternalUri
|
||||
*/
|
||||
protected $processPlugin;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
|
||||
$this->processPlugin = new InternalUri([], 'd7_internal_uri', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests InternalUri::transform().
|
||||
*
|
||||
* @param array $value
|
||||
* The value to pass to InternalUri::transform().
|
||||
* @param string $expected
|
||||
* The expected return value of InternalUri::transform().
|
||||
*
|
||||
* @dataProvider providerTestTransform
|
||||
*
|
||||
* @covers ::transform
|
||||
*/
|
||||
public function testTransform(array $value, $expected) {
|
||||
$migrate_executable = $this->prophesize(MigrateExecutableInterface::class);
|
||||
$row = $this->prophesize(Row::class);
|
||||
|
||||
$actual = $this->processPlugin->transform($value, $migrate_executable->reveal(), $row->reveal(), 'link/uri');
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides test cases for InternalUriTest::testTransform().
|
||||
*
|
||||
* @return array
|
||||
* An array of test cases, each which the following values:
|
||||
* - The value array to pass to InternalUri::transform().
|
||||
* - The expected path returned by InternalUri::transform().
|
||||
*/
|
||||
public function providerTestTransform() {
|
||||
$tests = [];
|
||||
$tests['with_scheme'] = [['http://example.com'], 'http://example.com'];
|
||||
$tests['leading_slash'] = [['/test'], 'internal:/test'];
|
||||
$tests['without_scheme'] = [['test'], 'internal:/test'];
|
||||
$tests['front'] = [['<front>'], 'internal:/'];
|
||||
$tests['node'] = [['node/27'], 'entity:node/27'];
|
||||
return $tests;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in a new issue