You are here

protected function HierarchicalFacetIntegrationTest::verifyExpandHierarchyOption in Facets 8

Verify the "Always expand hierarchy" option is working.

1 call to HierarchicalFacetIntegrationTest::verifyExpandHierarchyOption()
HierarchicalFacetIntegrationTest::testHierarchicalFacet in tests/src/Functional/HierarchicalFacetIntegrationTest.php
Test the hierarchical facets functionality.

File

tests/src/Functional/HierarchicalFacetIntegrationTest.php, line 198

Class

HierarchicalFacetIntegrationTest
Tests the hierarchical facets implementation.

Namespace

Drupal\Tests\facets\Functional

Code

protected function verifyExpandHierarchyOption() {

  // Expand the hierarchy and verify that all items are visible initially.
  $this
    ->drupalGet($this->facetEditPage);
  $edit = [
    'facet_settings[expand_hierarchy]' => '1',
    'facet_settings[keep_hierarchy_parents_active]' => FALSE,
    'facet_settings[use_hierarchy]' => '1',
    'facet_settings[translate_entity][status]' => '1',
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Save');
  $this
    ->drupalGet('search-api-test-fulltext');
  $this
    ->assertFacetLabel('Parent 1');
  $this
    ->assertFacetLabel('Parent 2');
  $this
    ->assertFacetLabel('Child 1');
  $this
    ->assertFacetLabel('Child 2');
  $this
    ->assertFacetLabel('Child 3');
  $this
    ->assertFacetLabel('Child 4');
}