You are here

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

Test url: News » Category A » Item A

File

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

Class

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

Namespace

Drupal\Tests\menu_trail_by_path\Functional

Code

public function testUrlNewsCategoryaItema() {
  $node3 = $this
    ->drupalCreateNode();
  \Drupal::service('path.alias_storage')
    ->save('/node/' . $node3
    ->id(), '/news/category-a/item-a');
  $this
    ->drupalGet($node3
    ->toUrl());
  $this
    ->assertMenuActiveTrail([
    $this
      ->menuUrlBasePath('News') => 'News',
    $this
      ->menuUrlBasePath('News » Category A') => 'Category A',
  ], FALSE);

  // 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($node3
    ->toUrl());
  $this
    ->assertNoRaw('menu-item--active-trail');
}