You are here

public function MenuTrailByPathActiveTrailHtmlClassTest::testUrlUserPassword in Menu Trail By Path 8

Test url: User password

File

tests/src/Functional/MenuTrailByPathActiveTrailHtmlClassTest.php, line 108

Class

MenuTrailByPathActiveTrailHtmlClassTest
Tests that the menu links have the correct css-classes.

Namespace

Drupal\Tests\menu_trail_by_path\Functional

Code

public function testUrlUserPassword() {
  $this
    ->drupalGet(clone $this->menuUrls['User password']);
  $this
    ->assertMenuActiveTrail([
    $this
      ->menuUrlBasePath('User password') => 'User password',
  ], TRUE);

  // Change the global setting to use the core implementation.
  $this
    ->config('menu_trail_by_path.settings')
    ->set('trail_source', MenuTrailByPathActiveTrail::MENU_TRAIL_CORE)
    ->save();
  $this
    ->rebuildAll();
  $this
    ->drupalGet(clone $this->menuUrls['User password']);
  $this
    ->assertMenuActiveTrail([
    $this
      ->menuUrlBasePath('User password') => 'User password',
  ], TRUE);

  // Change the global setting to use the core implementation.
  $this
    ->config('menu_trail_by_path.settings')
    ->set('trail_source', MenuTrailByPathActiveTrail::MENU_TRAIL_DISABLED)
    ->save();
  $this
    ->rebuildAll();
  $this
    ->drupalGet(clone $this->menuUrls['User password']);
  $this
    ->assertNoRaw('menu-item--active-trail');

  // Set a menu specific setting to override the default.
  $menu = Menu::load('main');
  $menu
    ->setThirdPartySetting('menu_trail_by_path', 'trail_source', MenuTrailByPathActiveTrail::MENU_TRAIL_PATH);
  $menu
    ->save();
  $this
    ->drupalGet(clone $this->menuUrls['User password']);
  $this
    ->assertMenuActiveTrail([
    $this
      ->menuUrlBasePath('User password') => 'User password',
  ], TRUE);
}