You are here

public function FacetSourceTest::testEditBreadcrumbSettings in Facets 8

Tests editing the breadcrumb settings.

File

tests/src/Functional/FacetSourceTest.php, line 89

Class

FacetSourceTest
Tests the functionality of the facet source config entity.

Namespace

Drupal\Tests\facets\Functional

Code

public function testEditBreadcrumbSettings() {
  $this
    ->assertSession()
    ->fieldExists('breadcrumb[active]');
  $this
    ->assertSession()
    ->fieldExists('breadcrumb[group]');
  $this
    ->assertSession()
    ->checkboxNotChecked('breadcrumb[group]');
  $this
    ->assertSession()
    ->checkboxNotChecked('breadcrumb[active]');

  // Change the breadcrumb settings.
  $edit = [
    'breadcrumb[active]' => TRUE,
    'breadcrumb[group]' => TRUE,
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Save');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->addressEquals('admin/config/search/facets');
  $this
    ->assertSession()
    ->pageTextContains('Facet source search_api:views_block__search_api_test_view__block_1 has been saved.');
  $this
    ->clickLink('Configure');

  // Test that saving worked and that the url processor has the new value.
  $this
    ->assertSession()
    ->checkboxChecked('breadcrumb[group]');
  $this
    ->assertSession()
    ->checkboxChecked('breadcrumb[active]');
}