You are here

protected function MenuBlockCurrentLanguageTest::createTestLink in Menu block current language 8

Create new menu link.

Parameters

string $langcode: The language code.

string $title: The title.

array $overrides: The overrides.

Return value

\Drupal\Core\Entity\EntityInterface The menu link.

1 call to MenuBlockCurrentLanguageTest::createTestLink()
MenuBlockCurrentLanguageTest::testMenuBlockLanguageFilters in tests/src/Functional/MenuBlockCurrentLanguageTest.php
Tests that menu links are only visible for translated languages.

File

tests/src/Functional/MenuBlockCurrentLanguageTest.php, line 104

Class

MenuBlockCurrentLanguageTest
Functional tests for menu_block_current_language.

Namespace

Drupal\Tests\menu_block_current_language\Functional

Code

protected function createTestLink($langcode, $title, array $overrides = []) {
  $defaults = [
    'menu_name' => 'main',
    'title' => $title,
    'langcode' => $langcode,
    'link' => [
      'uri' => 'internal:/test-page',
    ],
  ];
  $link = MenuLinkContent::create($overrides + $defaults);
  $link
    ->save();
  return $link;
}