From 01b3613b24834eae7584aa679f358191a73e189a Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org> Date: Thu, 21 Jan 2016 16:36:34 +0900 Subject: [PATCH] Issue #2641592 by Mac_Weber: Replace deprecated usage of entity_create('menu') with a direct call to Menu::create() --- core/modules/menu_link_content/src/Tests/LinksTest.php | 3 ++- core/modules/menu_ui/src/Tests/MenuCacheTagsTest.php | 3 ++- core/modules/menu_ui/src/Tests/MenuTest.php | 2 +- core/modules/system/src/Tests/Block/SystemMenuBlockTest.php | 4 +++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/core/modules/menu_link_content/src/Tests/LinksTest.php b/core/modules/menu_link_content/src/Tests/LinksTest.php index 29a8d9715ca8..0c660e8686e1 100644 --- a/core/modules/menu_link_content/src/Tests/LinksTest.php +++ b/core/modules/menu_link_content/src/Tests/LinksTest.php @@ -9,6 +9,7 @@ use Drupal\Component\Utility\SafeMarkup; use Drupal\simpletest\WebTestBase; +use Drupal\system\Entity\Menu; /** * Tests handling of menu links hierarchies. @@ -39,7 +40,7 @@ protected function setUp() { $this->menuLinkManager = \Drupal::service('plugin.manager.menu.link'); - entity_create('menu', array( + Menu::create(array( 'id' => 'menu_test', 'label' => 'Test menu', 'description' => 'Description text', diff --git a/core/modules/menu_ui/src/Tests/MenuCacheTagsTest.php b/core/modules/menu_ui/src/Tests/MenuCacheTagsTest.php index 520627ed797e..5d9ce5ffde70 100644 --- a/core/modules/menu_ui/src/Tests/MenuCacheTagsTest.php +++ b/core/modules/menu_ui/src/Tests/MenuCacheTagsTest.php @@ -9,6 +9,7 @@ use Drupal\Core\Url; use Drupal\system\Tests\Cache\PageCacheTagsTestBase; +use Drupal\system\Entity\Menu; /** * Tests the Menu and Menu Link entities' cache tags. @@ -32,7 +33,7 @@ public function testMenuBlock() { $url = Url::fromRoute('test_page_test.test_page'); // Create a Llama menu, add a link to it and place the corresponding block. - $menu = entity_create('menu', array( + $menu = Menu::create(array( 'id' => 'llama', 'label' => 'Llama', 'description' => 'Description text', diff --git a/core/modules/menu_ui/src/Tests/MenuTest.php b/core/modules/menu_ui/src/Tests/MenuTest.php index d88911ad3ee7..d350ab62ae45 100644 --- a/core/modules/menu_ui/src/Tests/MenuTest.php +++ b/core/modules/menu_ui/src/Tests/MenuTest.php @@ -157,7 +157,7 @@ function addCustomMenuCRUD() { $menu_name = substr(hash('sha256', $this->randomMachineName(16)), 0, MENU_MAX_MENU_NAME_LENGTH_UI); $label = $this->randomMachineName(16); - $menu = entity_create('menu', array( + $menu = Menu::create(array( 'id' => $menu_name, 'label' => $label, 'description' => 'Description text', diff --git a/core/modules/system/src/Tests/Block/SystemMenuBlockTest.php b/core/modules/system/src/Tests/Block/SystemMenuBlockTest.php index e10a6af85698..4e6db75bb2aa 100644 --- a/core/modules/system/src/Tests/Block/SystemMenuBlockTest.php +++ b/core/modules/system/src/Tests/Block/SystemMenuBlockTest.php @@ -6,6 +6,8 @@ namespace Drupal\system\Tests\Block; +use Drupal\system\Entity\Menu; + use Drupal\Core\Render\Element; use Drupal\simpletest\KernelTestBase; use Drupal\system\Tests\Routing\MockRouteProvider; @@ -118,7 +120,7 @@ protected function setUp() { $menu_name = 'mock'; $label = $this->randomMachineName(16); - $this->menu = entity_create('menu', array( + $this->menu = Menu::create(array( 'id' => $menu_name, 'label' => $label, 'description' => 'Description text', -- GitLab