function MenuUiTest::addInvalidMenuLink
Attempts to add menu link with invalid path or no access permission.
1 call to MenuUiTest::addInvalidMenuLink()
- MenuUiTest::testMenu in core/modules/ menu_ui/ tests/ src/ Functional/ MenuUiTest.php 
- Tests menu functionality using the admin and user interfaces.
File
- 
              core/modules/ menu_ui/ tests/ src/ Functional/ MenuUiTest.php, line 644 
Class
- MenuUiTest
- Add a custom menu, add menu links to the custom menu and Tools menu, check their data, and delete them using the UI.
Namespace
Drupal\Tests\menu_ui\FunctionalCode
public function addInvalidMenuLink() {
  foreach ([
    'access' => '/admin/people/permissions',
  ] as $type => $link_path) {
    $edit = [
      'link[0][uri]' => $link_path,
      'title[0][value]' => 'title',
    ];
    $this->drupalPostForm("admin/structure/menu/manage/{$this->menu->id()}/add", $edit, t('Save'));
    $this->assertRaw(t("The path '@link_path' is inaccessible.", [
      '@link_path' => $link_path,
    ]), 'Menu link was not created');
  }
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
