You are here

public function QueryStringTest::testSeparator in Facets 8

Tests that the separator works as expected.

File

tests/src/Unit/Plugin/url_processor/QueryStringTest.php, line 321

Class

QueryStringTest
Unit test for processor.

Namespace

Drupal\Tests\facets\Unit\Plugin\url_processor

Code

public function testSeparator() {
  $facet = new Facet([], 'facets_facet');
  $facet
    ->setFieldIdentifier('test');
  $facet
    ->setUrlAlias('test');
  $facet
    ->setFacetSourceId('facet_source__dummy');
  $this->processor = new QueryString([
    'facet' => $facet,
    'separator' => '__',
  ], 'query_string', [], new Request(), $this->entityManager, $this->eventDispatcher);
  $results = $this->processor
    ->buildUrls($facet, $this->originalResults);
  foreach ($results as $result) {
    $this
      ->assertEquals('route:test?f%5B0%5D=test__' . $result
      ->getRawValue(), $result
      ->getUrl()
      ->toUriString());
  }
}