You are here

public function FacetsUrlGeneratorTest::testCreateUrl in Facets 8

Create url.

File

tests/src/Functional/FacetsUrlGeneratorTest.php, line 52

Class

FacetsUrlGeneratorTest
Class FacetsUrlGeneratorTest.

Namespace

Drupal\Tests\facets\Functional

Code

public function testCreateUrl() {

  /** @var \Drupal\facets\FacetInterface $entity */
  $entity = Facet::create([
    'id' => 'test_facet',
    'name' => 'Test facet',
  ]);
  $entity
    ->setWidget('links');
  $entity
    ->setEmptyBehavior([
    'behavior' => 'none',
  ]);
  $entity
    ->setUrlAlias('owl');
  $entity
    ->setFacetSourceId('search_api:views_page__search_api_test_view__page_1');
  $entity
    ->save();
  $url = $this->urlGenerator
    ->getUrl([
    'test_facet' => [
      'fuzzy',
    ],
  ]);
  $this
    ->assertEquals('route:view.search_api_test_view.page_1;arg_0&arg_1&arg_2?f%5B0%5D=owl%3Afuzzy', $url
    ->toUriString());
}