You are here

public function FacetsUrlGeneratorTest::testInvalidArray in Facets 8

Tests that passing an invalid facet ID throws an InvalidArgumentException.

@covers ::getUrl

File

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

Class

FacetsUrlGeneratorTest
Class FacetsUrlGeneratorTest.

Namespace

Drupal\Tests\facets\Unit\Utility

Code

public function testInvalidArray() {
  $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: [imaginary => ['value1', 'value2']]");
  $url_generator
    ->getUrl([
    'imaginary' => 'unicorn',
  ]);
}