You are here

public function BreadcrumbIntegrationTest::testBreadcrumbLabel in Facets 8

Tests enabling + disabling the breadcrumb label prefix.

File

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

Class

BreadcrumbIntegrationTest
Tests the overall functionality of the Facets admin UI.

Namespace

Drupal\Tests\facets\Functional

Code

public function testBreadcrumbLabel() {
  $id = 'type';
  $this
    ->createFacet('Type', $id);
  $this
    ->resetAll();
  $this
    ->drupalGet('admin/config/search/facets/' . $id . '/edit');
  $this
    ->drupalPostForm(NULL, [
    'facet_settings[weight]' => '1',
  ], 'Save');
  $this
    ->editFacetConfig([
    'breadcrumb[before]' => FALSE,
  ]);
  $initial_query = [
    'search_api_fulltext' => 'foo',
  ];
  $this
    ->drupalGet('search-api-test-fulltext', [
    'query' => $initial_query,
  ]);
  $this
    ->clickLink('item');
  $breadcrumb = $this
    ->getSession()
    ->getPage()
    ->find('css', '.breadcrumb');
  $this
    ->assertFalse(strpos($breadcrumb
    ->getText(), 'Type'));
  $breadcrumb
    ->findLink('item');
  $this
    ->editFacetConfig([
    'breadcrumb[before]' => TRUE,
  ]);
  $initial_query = [
    'search_api_fulltext' => 'foo',
  ];
  $this
    ->drupalGet('search-api-test-fulltext', [
    'query' => $initial_query,
  ]);
  $this
    ->clickLink('item');
  $breadcrumb = $this
    ->getSession()
    ->getPage()
    ->find('css', '.breadcrumb');
  $this
    ->assertNotFalse(strpos($breadcrumb
    ->getText(), 'Type'));
}