You are here

protected function TestHelperTrait::checkFacetIsNotActive in Facets 8

Check if a facet is not active by providing a label for it.

We'll check by activeness by seeing that there's no span with (-) in the same link as the label.

Parameters

string $label: The label of a facet that should be active.

Return value

bool Returns true when the facet is found and is active.

5 calls to TestHelperTrait::checkFacetIsNotActive()
BreadcrumbIntegrationTest::breadcrumbTest in tests/src/Functional/BreadcrumbIntegrationTest.php
Tests Breadcrumb with the given config.
FacetsUrlGeneratorTest::testWithAlreadySetFacet in tests/src/Functional/FacetsUrlGeneratorTest.php
Create url with already set facet.
HierarchicalFacetIntegrationTest::verifyEnableParentWhenChildGetsDisabledOption in tests/src/Functional/HierarchicalFacetIntegrationTest.php
Verify the "Enable parent when child gets disabled" option is working.
HierarchicalFacetIntegrationTest::verifyKeepHierarchyParentsActiveOption in tests/src/Functional/HierarchicalFacetIntegrationTest.php
Verify the "Keep parents active" option is working.
WidgetIntegrationTest::testAllLink in tests/src/Functional/WidgetIntegrationTest.php
Tests the all link.

File

tests/src/Functional/TestHelperTrait.php, line 54

Class

TestHelperTrait
Adds helpers for test methods.

Namespace

Drupal\Tests\facets\Functional

Code

protected function checkFacetIsNotActive($label) {
  $label = (string) $label;
  $label = strip_tags($label);
  $links = $this
    ->xpath('//a/span[1][normalize-space(text())=:label]', [
    ':label' => $label,
  ]);
  return $this
    ->assertArrayHasKey(0, $links);
}