You are here

public function FacetSourceTest::testGetterSetters in Facets 8

Tests simple getters / setters.

@covers ::getName @covers ::setFilterKey @covers ::getFilterKey @covers ::setUrlProcessor @covers ::getUrlProcessorName @covers ::setBreadcrumbSettings @covers ::getBreadcrumbSettings

File

tests/src/Kernel/Entity/FacetSourceTest.php, line 66

Class

FacetSourceTest
Class FacetSourceTest.

Namespace

Drupal\Tests\facets\Kernel\Entity

Code

public function testGetterSetters() {
  $fs = new FacetSource([
    'id' => 'llama',
  ], 'facets_facet_source');
  $this
    ->assertNull($fs
    ->getFilterKey());
  $this
    ->assertNull($fs
    ->getName());
  $this
    ->assertEquals('query_string', $fs
    ->getUrlProcessorName());
  $this
    ->assertEmpty($fs
    ->getBreadcrumbSettings());
  $fs
    ->setFilterKey('ab');
  $this
    ->assertEquals('ab', $fs
    ->getFilterKey());
  $fs
    ->setUrlProcessor('test');
  $this
    ->assertEquals('test', $fs
    ->getUrlProcessorName());
  $breadcrumb_settings = [
    'active' => 1,
    'group' => 1,
  ];
  $fs
    ->setBreadcrumbSettings($breadcrumb_settings);
  $this
    ->assertEquals($breadcrumb_settings, $fs
    ->getBreadcrumbSettings());
}