summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2016-02-16 03:38:26 (GMT)
committerNathaniel Catchpole2016-02-16 03:38:26 (GMT)
commita9c6d59c8350cdfa88a1ee3ec30eaa714851c3d8 (patch)
tree18eb87c08c64d1aeb77340b9b581d44cf0cc7db6
parent049224c8752ebbe4c870eeb177a10f272248bf54 (diff)
Issue #2641696 by naveenvalecha, heykarthikwithu, Mac_Weber: Replace deprecated usage of entity_create('menu_link_content') with a direct call to MenuLinkContent::create()
-rw-r--r--core/modules/menu_link_content/src/Tests/LinksTest.php13
-rw-r--r--core/modules/menu_ui/menu_ui.module2
-rw-r--r--core/modules/menu_ui/src/Tests/MenuCacheTagsTest.php3
-rw-r--r--core/modules/menu_ui/src/Tests/MenuNodeTest.php4
4 files changed, 12 insertions, 10 deletions
diff --git a/core/modules/menu_link_content/src/Tests/LinksTest.php b/core/modules/menu_link_content/src/Tests/LinksTest.php
index 0c660e8..46e3d60 100644
--- a/core/modules/menu_link_content/src/Tests/LinksTest.php
+++ b/core/modules/menu_link_content/src/Tests/LinksTest.php
@@ -8,6 +8,7 @@
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;
@@ -69,7 +70,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();
@@ -77,7 +78,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();
@@ -85,7 +86,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();
@@ -93,7 +94,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();
@@ -101,7 +102,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();
@@ -130,7 +131,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.');
diff --git a/core/modules/menu_ui/menu_ui.module b/core/modules/menu_ui/menu_ui.module
index f32608c..c3d87c4 100644
--- a/core/modules/menu_ui/menu_ui.module
+++ b/core/modules/menu_ui/menu_ui.module
@@ -142,7 +142,7 @@ function _menu_ui_node_save(NodeInterface $node, array $values) {
}
else {
// Create a new menu_link_content entity.
- $entity = entity_create('menu_link_content', array(
+ $entity = MenuLinkContent::create(array(
'link' => ['uri' => 'entity:node/' . $node->id()],
'langcode' => $node->getUntranslated()->language()->getId(),
));
diff --git a/core/modules/menu_ui/src/Tests/MenuCacheTagsTest.php b/core/modules/menu_ui/src/Tests/MenuCacheTagsTest.php
index 5d9ce5f..5e8e691 100644
--- a/core/modules/menu_ui/src/Tests/MenuCacheTagsTest.php
+++ b/core/modules/menu_ui/src/Tests/MenuCacheTagsTest.php
@@ -8,6 +8,7 @@
namespace Drupal\menu_ui\Tests;
use Drupal\Core\Url;
+use Drupal\menu_link_content\Entity\MenuLinkContent;
use Drupal\system\Tests\Cache\PageCacheTagsTestBase;
use Drupal\system\Entity\Menu;
@@ -80,7 +81,7 @@ class MenuCacheTagsTest extends PageCacheTagsTestBase {
// Verify that after adding a menu link, there is a cache miss.
$this->pass('Test addition of menu link.', 'Debug');
- $menu_link_2 = entity_create('menu_link_content', array(
+ $menu_link_2 = MenuLinkContent::create(array(
'id' => '',
'parent' => '',
'title' => 'Alpaca',
diff --git a/core/modules/menu_ui/src/Tests/MenuNodeTest.php b/core/modules/menu_ui/src/Tests/MenuNodeTest.php
index b57cc9d..4b99703 100644
--- a/core/modules/menu_ui/src/Tests/MenuNodeTest.php
+++ b/core/modules/menu_ui/src/Tests/MenuNodeTest.php
@@ -198,7 +198,7 @@ class MenuNodeTest extends WebTestBase {
$this->assertNoLink($node_title);
// Add a menu link to the Administration menu.
- $item = entity_create('menu_link_content', array(
+ $item = MenuLinkContent::create(array(
'link' => [['uri' => 'entity:node/' . $node->id()]],
'title' => $this->randomMachineName(16),
'menu_name' => 'admin',
@@ -220,7 +220,7 @@ class MenuNodeTest extends WebTestBase {
// Create a second node.
$child_node = $this->drupalCreateNode(array('type' => 'article'));
// Assign a menu link to the second node, being a child of the first one.
- $child_item = entity_create('menu_link_content', array(
+ $child_item = MenuLinkContent::create(array(
'link' => [['uri' => 'entity:node/' . $child_node->id()]],
'title' => $this->randomMachineName(16),
'parent' => $item->getPluginId(),