You are here

protected function BreadcrumbIntegrationTest::breadcrumbTest in Facets 8

Tests Breadcrumb with the given config.

1 call to BreadcrumbIntegrationTest::breadcrumbTest()
BreadcrumbIntegrationTest::testGroupingIntegration in tests/src/Functional/BreadcrumbIntegrationTest.php
Tests Breadcrumb integration with grouping.

File

tests/src/Functional/BreadcrumbIntegrationTest.php, line 138

Class

BreadcrumbIntegrationTest
Tests the overall functionality of the Facets admin UI.

Namespace

Drupal\Tests\facets\Functional

Code

protected function breadcrumbTest() {

  // Breadcrumb should show Keywords: orange > Type: article, item.
  $initial_query = [
    'search_api_fulltext' => 'foo',
    'test_param' => 1,
  ];
  $this
    ->drupalGet('search-api-test-fulltext', [
    'query' => $initial_query,
  ]);
  $this
    ->clickLink('item');
  $this
    ->assertSession()
    ->linkExists('Type: item');
  $this
    ->clickLink('article');
  $this
    ->assertSession()
    ->linkExists('Type: article, item');
  $this
    ->clickLink('orange');
  $this
    ->assertSession()
    ->linkExists('Keywords: orange');
  $this
    ->assertSession()
    ->linkExists('Type: article, item');
  $this
    ->clickLink('Type: article, item');
  $this
    ->assertSession()
    ->linkExists('Keywords: orange');
  $this
    ->assertSession()
    ->linkExists('Type: article, item');
  $this
    ->checkFacetIsActive('orange');
  $this
    ->checkFacetIsActive('item');
  $this
    ->checkFacetIsActive('article');
  $this
    ->clickLink('Keywords: orange');
  $this
    ->assertSession()
    ->linkExists('Keywords: orange');
  $this
    ->assertSession()
    ->linkNotExists('Type: article, item');
  $this
    ->checkFacetIsActive('orange');
  $this
    ->checkFacetIsNotActive('item');
  $this
    ->checkFacetIsNotActive('article');

  // Check that the current url still has the initial parameters.
  $curr_url = UrlHelper::parse($this
    ->getUrl());
  $this
    ->assertArraySubset($initial_query, $curr_url['query']);
}