X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fmenu_link_content%2Ftests%2Fsrc%2FFunctional%2FUpdate%2FMenuLinkContentUpdateTest.php;fp=web%2Fcore%2Fmodules%2Fmenu_link_content%2Ftests%2Fsrc%2FFunctional%2FUpdate%2FMenuLinkContentUpdateTest.php;h=145863790e0c08a0d01a76a40a7acda9f011d447;hp=0000000000000000000000000000000000000000;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/modules/menu_link_content/tests/src/Functional/Update/MenuLinkContentUpdateTest.php b/web/core/modules/menu_link_content/tests/src/Functional/Update/MenuLinkContentUpdateTest.php new file mode 100644 index 000000000..145863790 --- /dev/null +++ b/web/core/modules/menu_link_content/tests/src/Functional/Update/MenuLinkContentUpdateTest.php @@ -0,0 +1,69 @@ +databaseDumpFiles = [ + __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.filled.standard.php.gz', + ]; + } + + /** + * Tests the addition of the publishing status entity key. + * + * @see menu_link_content_update_8601() + */ + public function testPublishedEntityKeyAddition() { + $this->runUpdates(); + + // Log in as user 1. + $account = User::load(1); + $account->passRaw = 'drupal'; + $this->drupalLogin($account); + + // Make sure our custom menu link exists. + $assert_session = $this->assertSession(); + $this->drupalGet('admin/structure/menu/item/1/edit'); + $assert_session->checkboxChecked('edit-enabled-value'); + + // Check that custom menu links can be created, saved and then loaded. + $storage = \Drupal::entityTypeManager()->getStorage('menu_link_content'); + /** @var \Drupal\menu_link_content\Entity\MenuLinkContent $menu_link */ + $menu_link = $storage->create([ + 'menu_name' => 'main', + 'link' => 'route:user.page', + 'title' => 'Pineapple', + ]); + $menu_link->save(); + + $menu_link = $storage->loadUnchanged($menu_link->id()); + + $this->assertEquals('main', $menu_link->getMenuName()); + $this->assertEquals('Pineapple', $menu_link->label()); + $this->assertEquals('route:user.page', $menu_link->link->uri); + $this->assertTrue($menu_link->isPublished()); + } + + /** + * {@inheritdoc} + */ + protected function replaceUser1() { + // Do not replace the user from our dump. + } + +}