You are here

public function DefaultFacetManagerTest::testGetEnabledFacets in Facets 8

Tests the getEnabledFacets method.

@covers ::getEnabledFacets

File

tests/src/Kernel/FacetManager/DefaultFacetManagerTest.php, line 39

Class

DefaultFacetManagerTest
Class DefaultFacetManagerTest.

Namespace

Drupal\Tests\facets\Kernel\FacetManager

Code

public function testGetEnabledFacets() {

  /** @var \Drupal\facets\FacetManager\DefaultFacetManager $dfm */
  $dfm = \Drupal::service('facets.manager');
  $returnValue = $dfm
    ->getEnabledFacets();
  $this
    ->assertEmpty($returnValue);

  // Create a facet.
  $entity = $this
    ->createAndSaveFacet('test_facet');
  $returnValue = $dfm
    ->getEnabledFacets();
  $this
    ->assertNotEmpty($returnValue);
  $this
    ->assertSame($entity
    ->id(), $returnValue['test_facet']
    ->id());
}