Update to Drupal 8.1.0. For more information, see https://www.drupal.org/drupal-8.1.0-release-notes
This commit is contained in:
parent
b11a755ba8
commit
c0a0d5a94c
6920 changed files with 64395 additions and 57312 deletions
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Controller\MenuController.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Controller;
|
||||
|
||||
use Drupal\Core\Controller\ControllerBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Entity\MenuLinkContent.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Entity;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Form\MenuLinkContentDeleteForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Form;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityDeleteForm;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Form\MenuLinkContentForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Form;
|
||||
|
||||
use Drupal\Core\Entity\ContentEntityForm;
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\MenuLinkContentAccessControlHandler.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content;
|
||||
|
||||
|
@ -64,7 +60,7 @@ class MenuLinkContentAccessControlHandler extends EntityAccessControlHandler imp
|
|||
}
|
||||
else {
|
||||
// If there is a URL, this is an external link so always accessible.
|
||||
$access = AccessResult::allowed()->cachePerPermissions()->cacheUntilEntityChanges($entity);
|
||||
$access = AccessResult::allowed()->cachePerPermissions()->addCacheableDependency($entity);
|
||||
/** @var \Drupal\menu_link_content\MenuLinkContentInterface $entity */
|
||||
// We allow access, but only if the link is accessible as well.
|
||||
if (($url_object = $entity->getUrlObject()) && $url_object->isRouted()) {
|
||||
|
@ -75,7 +71,7 @@ class MenuLinkContentAccessControlHandler extends EntityAccessControlHandler imp
|
|||
}
|
||||
|
||||
case 'delete':
|
||||
return AccessResult::allowedIf(!$entity->isNew() && $account->hasPermission('administer menu'))->cachePerPermissions()->cacheUntilEntityChanges($entity);
|
||||
return AccessResult::allowedIf(!$entity->isNew() && $account->hasPermission('administer menu'))->cachePerPermissions()->addCacheableDependency($entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\MenuLinkContentInterface.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content;
|
||||
|
||||
use Drupal\Core\Entity\EntityChangedInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\MenuLinkContentStorageSchema.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content;
|
||||
|
||||
use Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Plugin\Deriver\MenuLinkContentDeriver.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Plugin\Deriver;
|
||||
|
||||
use Drupal\Component\Plugin\Derivative\DeriverBase;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Plugin\Menu\MenuLinkContent.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Plugin\Menu;
|
||||
|
||||
use Drupal\Component\Plugin\Exception\PluginException;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Plugin\migrate\process\d6\InternalUri.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Plugin\migrate\process\d6;
|
||||
|
||||
use Drupal\migrate\MigrateExecutableInterface;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Plugin\migrate\source\MenuLink.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Plugin\migrate\source;
|
||||
|
||||
use Drupal\Component\Utility\Unicode;
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Tests\LinksTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Tests;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\menu_link_content\Entity\MenuLinkContent;
|
||||
use Drupal\simpletest\WebTestBase;
|
||||
use Drupal\system\Entity\Menu;
|
||||
|
||||
/**
|
||||
* Tests handling of menu links hierarchies.
|
||||
|
@ -39,7 +36,7 @@ class LinksTest extends WebTestBase {
|
|||
|
||||
$this->menuLinkManager = \Drupal::service('plugin.manager.menu.link');
|
||||
|
||||
entity_create('menu', array(
|
||||
Menu::create(array(
|
||||
'id' => 'menu_test',
|
||||
'label' => 'Test menu',
|
||||
'description' => 'Description text',
|
||||
|
@ -68,7 +65,7 @@ class LinksTest extends WebTestBase {
|
|||
$parent = $base_options + array(
|
||||
'link' => ['uri' => 'internal:/menu-test/hierarchy/parent'],
|
||||
);
|
||||
$link = entity_create('menu_link_content', $parent);
|
||||
$link = MenuLinkContent::create($parent);
|
||||
$link->save();
|
||||
$links['parent'] = $link->getPluginId();
|
||||
|
||||
|
@ -76,7 +73,7 @@ class LinksTest extends WebTestBase {
|
|||
'link' => ['uri' => 'internal:/menu-test/hierarchy/parent/child'],
|
||||
'parent' => $links['parent'],
|
||||
);
|
||||
$link = entity_create('menu_link_content', $child_1);
|
||||
$link = MenuLinkContent::create($child_1);
|
||||
$link->save();
|
||||
$links['child-1'] = $link->getPluginId();
|
||||
|
||||
|
@ -84,7 +81,7 @@ class LinksTest extends WebTestBase {
|
|||
'link' => ['uri' => 'internal:/menu-test/hierarchy/parent/child2/child'],
|
||||
'parent' => $links['child-1'],
|
||||
);
|
||||
$link = entity_create('menu_link_content', $child_1_1);
|
||||
$link = MenuLinkContent::create($child_1_1);
|
||||
$link->save();
|
||||
$links['child-1-1'] = $link->getPluginId();
|
||||
|
||||
|
@ -92,7 +89,7 @@ class LinksTest extends WebTestBase {
|
|||
'link' => ['uri' => 'internal:/menu-test/hierarchy/parent/child2/child'],
|
||||
'parent' => $links['child-1'],
|
||||
);
|
||||
$link = entity_create('menu_link_content', $child_1_2);
|
||||
$link = MenuLinkContent::create($child_1_2);
|
||||
$link->save();
|
||||
$links['child-1-2'] = $link->getPluginId();
|
||||
|
||||
|
@ -100,7 +97,7 @@ class LinksTest extends WebTestBase {
|
|||
'link' => ['uri' => 'internal:/menu-test/hierarchy/parent/child'],
|
||||
'parent' => $links['parent'],
|
||||
);
|
||||
$link = entity_create('menu_link_content', $child_2);
|
||||
$link = MenuLinkContent::create($child_2);
|
||||
$link->save();
|
||||
$links['child-2'] = $link->getPluginId();
|
||||
|
||||
|
@ -129,7 +126,7 @@ class LinksTest extends WebTestBase {
|
|||
'bundle' => 'menu_link_content',
|
||||
'link' => [['uri' => 'internal:/']],
|
||||
);
|
||||
$link = entity_create('menu_link_content', $options);
|
||||
$link = MenuLinkContent::create($options);
|
||||
$link->save();
|
||||
// Make sure the changed timestamp is set.
|
||||
$this->assertEqual($link->getChangedTime(), REQUEST_TIME, 'Creating a menu link sets the "changed" timestamp.');
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Tests\MenuLinkContentCacheabilityBubblingTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Tests;
|
||||
|
||||
use Drupal\Core\Cache\Cache;
|
||||
|
@ -39,7 +34,6 @@ class MenuLinkContentCacheabilityBubblingTest extends KernelTestBase {
|
|||
|
||||
$this->installEntitySchema('menu_link_content');
|
||||
$this->installEntitySchema('user');
|
||||
$this->installSchema('system', ['url_alias', 'router']);
|
||||
|
||||
// Ensure that the weight of module_link_content is higher than system.
|
||||
// @see menu_link_content_install()
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Tests\MenuLinkContentDeleteFormTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Tests;
|
||||
|
||||
|
@ -56,6 +52,8 @@ class MenuLinkContentDeleteFormTest extends WebTestBase {
|
|||
$this->assertLinkByHref($menu_link->url('edit-form'));
|
||||
|
||||
\Drupal::service('module_installer')->install(['menu_ui']);
|
||||
\Drupal::service('router.builder')->rebuild();
|
||||
|
||||
// Make sure cancel URL points to menu_ui route now.
|
||||
$this->drupalGet($menu_link->urlInfo('delete-form'));
|
||||
$menu = Menu::load($menu_link->getMenuName());
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Tests\MenuLinkContentDeriverTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Tests;
|
||||
|
||||
use Drupal\Component\Utility\SafeMarkup;
|
||||
use Drupal\Core\Menu\MenuTreeParameters;
|
||||
use Drupal\Core\StringTranslation\TranslatableMarkup;
|
||||
use Drupal\menu_link_content\Entity\MenuLinkContent;
|
||||
|
@ -33,7 +27,6 @@ class MenuLinkContentDeriverTest extends KernelTestBase {
|
|||
parent::setUp();
|
||||
|
||||
$this->installEntitySchema('menu_link_content');
|
||||
$this->installSchema('system', 'router');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,7 +66,6 @@ class MenuLinkContentDeriverTest extends KernelTestBase {
|
|||
$title = $tree_element->link->getTitle();
|
||||
$this->assertFalse($title instanceof TranslatableMarkup);
|
||||
$this->assertIdentical('<script>alert("Welcome to the discovered jungle!")</script>', $title);
|
||||
$this->assertFalse(SafeMarkup::isSafe($title));
|
||||
|
||||
// Create a hierarchy.
|
||||
\Drupal::state()->set('menu_link_content_dynamic_route.routes', [
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Tests\MenuLinkContentFormTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Tests;
|
||||
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Tests\MenuLinkContentTranslationUITest.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Tests;
|
||||
|
||||
use Drupal\content_translation\Tests\ContentTranslationUITestBase;
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Tests\Migrate\MigrateMenuLinkContentStubTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Tests\Migrate;
|
||||
|
||||
use Drupal\migrate_drupal\Tests\MigrateDrupalTestBase;
|
||||
use Drupal\migrate_drupal\Tests\StubTestTrait;
|
||||
|
||||
/**
|
||||
* Test stub creation for menu link content entities.
|
||||
*
|
||||
* @group menu_link_content
|
||||
*/
|
||||
class MigrateMenuLinkContentStubTest extends MigrateDrupalTestBase {
|
||||
|
||||
use StubTestTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = ['menu_link_content', 'link'];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installEntitySchema('menu_link_content');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests creation of menu link content stubs.
|
||||
*/
|
||||
public function testStub() {
|
||||
$this->performStubTest('menu_link_content');
|
||||
}
|
||||
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Tests\Migrate\d6\MigrateMenuLinkTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Tests\Migrate\d6;
|
||||
|
||||
use Drupal\menu_link_content\Entity\MenuLinkContent;
|
||||
use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
|
||||
|
||||
/**
|
||||
* Menu link migration.
|
||||
*
|
||||
* @group migrate_drupal_6
|
||||
*/
|
||||
class MigrateMenuLinkTest extends MigrateDrupal6TestBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = array('menu_ui', 'menu_link_content');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installSchema('system', ['router']);
|
||||
$this->installEntitySchema('menu_link_content');
|
||||
$this->executeMigrations(['menu', 'menu_links']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of menu links.
|
||||
*/
|
||||
public function testMenuLinks() {
|
||||
$menu_link = MenuLinkContent::load(138);
|
||||
$this->assertIdentical('Test 1', $menu_link->getTitle());
|
||||
$this->assertIdentical('secondary-links', $menu_link->getMenuName());
|
||||
$this->assertIdentical('Test menu link 1', $menu_link->getDescription());
|
||||
$this->assertIdentical(TRUE, $menu_link->isEnabled());
|
||||
$this->assertIdentical(FALSE, $menu_link->isExpanded());
|
||||
$this->assertIdentical(['attributes' => ['title' => 'Test menu link 1']], $menu_link->link->options);
|
||||
$this->assertIdentical('internal:/user/login', $menu_link->link->uri);
|
||||
$this->assertIdentical(-50, $menu_link->getWeight());
|
||||
|
||||
$menu_link = MenuLinkContent::load(139);
|
||||
$this->assertIdentical('Test 2', $menu_link->getTitle());
|
||||
$this->assertIdentical('secondary-links', $menu_link->getMenuName());
|
||||
$this->assertIdentical('Test menu link 2', $menu_link->getDescription());
|
||||
$this->assertIdentical(TRUE, $menu_link->isEnabled());
|
||||
$this->assertIdentical(TRUE, $menu_link->isExpanded());
|
||||
$this->assertIdentical(['query' => 'foo=bar', 'attributes' => ['title' => 'Test menu link 2']], $menu_link->link->options);
|
||||
$this->assertIdentical('internal:/admin', $menu_link->link->uri);
|
||||
$this->assertIdentical(-49, $menu_link->getWeight());
|
||||
|
||||
$menu_link = MenuLinkContent::load(140);
|
||||
$this->assertIdentical('Drupal.org', $menu_link->getTitle());
|
||||
$this->assertIdentical('secondary-links', $menu_link->getMenuName());
|
||||
$this->assertIdentical(NULL, $menu_link->getDescription());
|
||||
$this->assertIdentical(TRUE, $menu_link->isEnabled());
|
||||
$this->assertIdentical(FALSE, $menu_link->isExpanded());
|
||||
$this->assertIdentical(['attributes' => ['title' => '']], $menu_link->link->options);
|
||||
$this->assertIdentical('https://www.drupal.org', $menu_link->link->uri);
|
||||
$this->assertIdentical(-50, $menu_link->getWeight());
|
||||
|
||||
// assert that missing title attributes don't stop or break migration.
|
||||
$menu_link = MenuLinkContent::load(393);
|
||||
$this->assertIdentical('Test 3', $menu_link->getTitle());
|
||||
$this->assertIdentical('secondary-links', $menu_link->getMenuName());
|
||||
$this->assertIdentical(NULL, $menu_link->getDescription());
|
||||
$this->assertIdentical(TRUE, $menu_link->isEnabled());
|
||||
$this->assertIdentical(FALSE, $menu_link->isExpanded());
|
||||
$this->assertIdentical([], $menu_link->link->options);
|
||||
$this->assertIdentical('internal:/user/login', $menu_link->link->uri);
|
||||
$this->assertIdentical(-47, $menu_link->getWeight());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,133 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Tests\Migrate\d7\MigrateMenuLinkTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Tests\Migrate\d7;
|
||||
|
||||
use Drupal\Core\Database\Database;
|
||||
use Drupal\Core\Menu\MenuTreeParameters;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\menu_link_content\Entity\MenuLinkContent;
|
||||
use Drupal\menu_link_content\MenuLinkContentInterface;
|
||||
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
|
||||
|
||||
/**
|
||||
* Menu link migration.
|
||||
*
|
||||
* @group menu_link_content
|
||||
*/
|
||||
class MigrateMenuLinkTest extends MigrateDrupal7TestBase {
|
||||
const MENU_NAME = 'menu-test-menu';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static $modules = array('link', 'menu_ui', 'menu_link_content');
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp() {
|
||||
parent::setUp();
|
||||
$this->installSchema('system', ['router']);
|
||||
$this->installEntitySchema('menu_link_content');
|
||||
$this->executeMigration('menu');
|
||||
\Drupal::service('router.builder')->rebuild();
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts various aspects of a menu link entity.
|
||||
*
|
||||
* @param string $id
|
||||
* The link ID.
|
||||
* @param string $title
|
||||
* The expected title of the link.
|
||||
* @param string $menu
|
||||
* The expected ID of the menu to which the link will belong.
|
||||
* @param string $description
|
||||
* The link's expected description.
|
||||
* @param bool $enabled
|
||||
* Whether the link is enabled.
|
||||
* @param bool $expanded
|
||||
* Whether the link is expanded
|
||||
* @param array $attributes
|
||||
* Additional attributes the link is expected to have.
|
||||
* @param string $uri
|
||||
* The expected URI of the link.
|
||||
* @param int $weight
|
||||
* The expected weight of the link.
|
||||
*/
|
||||
protected function assertEntity($id, $title, $menu, $description, $enabled, $expanded, array $attributes, $uri, $weight) {
|
||||
/** @var \Drupal\menu_link_content\MenuLinkContentInterface $menu_link */
|
||||
$menu_link = MenuLinkContent::load($id);
|
||||
$this->assertTrue($menu_link instanceof MenuLinkContentInterface);
|
||||
$this->assertIdentical($title, $menu_link->getTitle());
|
||||
$this->assertIdentical($menu, $menu_link->getMenuName());
|
||||
// The migration sets the description of the link to the value of the
|
||||
// 'title' attribute. Bit strange, but there you go.
|
||||
$this->assertIdentical($description, $menu_link->getDescription());
|
||||
$this->assertIdentical($enabled, $menu_link->isEnabled());
|
||||
$this->assertIdentical($expanded, $menu_link->isExpanded());
|
||||
$this->assertIdentical($attributes, $menu_link->link->options);
|
||||
$this->assertIdentical($uri, $menu_link->link->uri);
|
||||
$this->assertIdentical($weight, $menu_link->getWeight());
|
||||
return $menu_link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migration of menu links.
|
||||
*/
|
||||
public function testMenuLinks() {
|
||||
$this->executeMigration('menu_links');
|
||||
$this->assertEntity(469, 'Bing', static::MENU_NAME, 'Bing', TRUE, FALSE, ['attributes' => ['title' => 'Bing']], 'http://bing.com', 0);
|
||||
$this->assertEntity(467, 'Google', static::MENU_NAME, 'Google', TRUE, FALSE, ['attributes' => ['title' => 'Google']], 'http://google.com', 0);
|
||||
$this->assertEntity(468, 'Yahoo', static::MENU_NAME, 'Yahoo', TRUE, FALSE, ['attributes' => ['title' => 'Yahoo']], 'http://yahoo.com', 0);
|
||||
$menu_link_tree_service = \Drupal::service('menu.link_tree');
|
||||
$parameters = new MenuTreeParameters();
|
||||
$tree = $menu_link_tree_service->load(static::MENU_NAME, $parameters);
|
||||
$this->assertEqual(2, count($tree));
|
||||
$children = 0;
|
||||
$google_found = FALSE;
|
||||
foreach ($tree as $menu_link_tree_element) {
|
||||
$children += $menu_link_tree_element->hasChildren;
|
||||
if ($menu_link_tree_element->link->getUrlObject()->toString() == 'http://bing.com') {
|
||||
$this->assertEqual(reset($menu_link_tree_element->subtree)->link->getUrlObject()->toString(), 'http://google.com');
|
||||
$google_found = TRUE;
|
||||
}
|
||||
}
|
||||
$this->assertEqual(1, $children);
|
||||
$this->assertTrue($google_found);
|
||||
// Now find the custom link under a system link.
|
||||
$parameters->root = 'system.admin_structure';
|
||||
$tree = $menu_link_tree_service->load(static::MENU_NAME, $parameters);
|
||||
$found = FALSE;
|
||||
foreach ($tree as $menu_link_tree_element) {
|
||||
$this->pass($menu_link_tree_element->link->getUrlObject()->toString());
|
||||
if ($menu_link_tree_element->link->getTitle() == 'custom link test') {
|
||||
$found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->assertTrue($found);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests migrating a link with an undefined title attribute.
|
||||
*/
|
||||
public function testUndefinedLinkTitle() {
|
||||
Database::getConnection('default', 'migrate')
|
||||
->update('menu_links')
|
||||
->fields(array(
|
||||
'options' => 'a:0:{}',
|
||||
))
|
||||
->condition('mlid', 467)
|
||||
->execute();
|
||||
|
||||
$this->executeMigration('menu_links');
|
||||
$this->assertEntity(467, 'Google', static::MENU_NAME, NULL, TRUE, FALSE, [], 'http://google.com', 0);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\menu_link_content\Tests\PathAliasMenuLinkContentTest.
|
||||
*/
|
||||
|
||||
namespace Drupal\menu_link_content\Tests;
|
||||
|
||||
use Drupal\Core\DependencyInjection\ContainerBuilder;
|
||||
|
@ -32,7 +27,6 @@ class PathAliasMenuLinkContentTest extends KernelTestBase {
|
|||
parent::setUp();
|
||||
|
||||
$this->installEntitySchema('menu_link_content');
|
||||
$this->installSchema('system', ['url_alias', 'router']);
|
||||
|
||||
// Ensure that the weight of module_link_content is higher than system.
|
||||
// @see menu_link_content_install()
|
||||
|
|
Reference in a new issue