public function FacetsUrlGeneratorTest::testInvalidFacet in Facets 8
Tests that passing an invalid facet ID throws an InvalidArgumentException.
@covers ::getUrl
File
- tests/
src/ Unit/ Utility/ FacetsUrlGeneratorTest.php, line 63
Class
- FacetsUrlGeneratorTest
- Class FacetsUrlGeneratorTest.
Namespace
Drupal\Tests\facets\Unit\UtilityCode
public function testInvalidFacet() {
$url_processor_plugin_manager = $this
->prophesize(UrlProcessorPluginManager::class)
->reveal();
$storage = $this
->prophesize(EntityStorageInterface::class);
$storage
->load(Argument::type('string'))
->willReturn(NULL);
$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 Facet imaginary could not be loaded.');
$url_generator
->getUrl([
'imaginary' => [
'unicorn',
],
]);
}