You are here

public function SummaryEntityTest::testFacets in Facets 8

Tests facets.

@covers ::setFacets @covers ::getFacets @covers ::removeFacet

File

modules/facets_summary/tests/src/Kernel/SummaryEntityTest.php, line 68

Class

SummaryEntityTest
Class SummaryEntityTest.

Namespace

Drupal\Tests\facets_summary\Kernel

Code

public function testFacets() {
  $entity = new FacetsSummary([
    'description' => 'Owls',
    'name' => 'owl',
  ], 'facets_summary');
  $this
    ->assertEmpty($entity
    ->getFacets());
  $facets = [
    'foo' => 'bar',
  ];
  $entity
    ->setFacets($facets);
  $this
    ->assertEquals($facets, $entity
    ->getFacets());
  $entity
    ->removeFacet('foo');
  $this
    ->assertEmpty($entity
    ->getFacets());
}