getTopLevelMenuLinks example



  /** * Tests output on administrative listing pages. */
  public function testAdminPages() {
    // Go to Administration.     $this->drupalGet('admin');

    // Verify that all visible, top-level administration links are listed on     // the main administration page.     foreach ($this->getTopLevelMenuLinks() as $item) {
      $this->assertSession()->linkExists($item->getTitle());
      $this->assertSession()->linkByHrefExists($item->getUrlObject()->toString());
      // The description should appear below the link.       $this->assertSession()->pageTextContains($item->getDescription());
    }

    // For each administrative listing page on which the Locale module appears,     // verify that there are links to the module's primary configuration pages,     // but no links to its individual sub-configuration pages. Also verify that     // a user with access to only some Locale module administration pages only     // sees links to the pages they have access to.
Home | Imprint | This part of the site doesn't use cookies.