You are here

public function FacetsUrlGeneratorTest::testEmptyArray in Facets 8

Tests that passing an invalid facet ID throws an InvalidArgumentException.

@covers ::getUrl

File

tests/src/Unit/Utility/FacetsUrlGeneratorTest.php, line 25

Class

FacetsUrlGeneratorTest
Class FacetsUrlGeneratorTest.

Namespace

Drupal\Tests\facets\Unit\Utility

Code

public function testEmptyArray() {
  $url_processor_plugin_manager = $this
    ->prophesize(UrlProcessorPluginManager::class)
    ->reveal();
  $storage = $this
    ->prophesize(EntityStorageInterface::class);
  $etm = $this
    ->prophesize(EntityTypeManagerInterface::class);
  $etm
    ->getStorage('facets_facet')
    ->willReturn($storage
    ->reveal());
  $url_generator = new FacetsUrlGenerator($url_processor_plugin_manager, $etm
    ->reveal());
  $this
    ->expectException(\InvalidArgumentException::class);
  $this
    ->expectExceptionMessage("The active filters passed in are invalid. They should look like: ['facet_id' => ['value1', 'value2']]");
  $url_generator
    ->getUrl([]);
}