You are here

protected function UrlProcessorHandlerTest::createContainer in Facets 8

Sets up a container.

5 calls to UrlProcessorHandlerTest::createContainer()
UrlProcessorHandlerTest::testBuild in tests/src/Unit/Plugin/processor/UrlProcessorHandlerTest.php
Tests that the build method is correctly called.
UrlProcessorHandlerTest::testConfiguration in tests/src/Unit/Plugin/processor/UrlProcessorHandlerTest.php
Tests configuration.
UrlProcessorHandlerTest::testDescription in tests/src/Unit/Plugin/processor/UrlProcessorHandlerTest.php
Tests testDescription().
UrlProcessorHandlerTest::testIsHidden in tests/src/Unit/Plugin/processor/UrlProcessorHandlerTest.php
Tests isHidden().
UrlProcessorHandlerTest::testIsLocked in tests/src/Unit/Plugin/processor/UrlProcessorHandlerTest.php
Tests isLocked().

File

tests/src/Unit/Plugin/processor/UrlProcessorHandlerTest.php, line 100

Class

UrlProcessorHandlerTest
Unit test for processor.

Namespace

Drupal\Tests\facets\Unit\Plugin\processor

Code

protected function createContainer() {
  $url_processor = $this
    ->getMockBuilder(UrlProcessorInterface::class)
    ->disableOriginalConstructor()
    ->getMock();
  $manager = $this
    ->getMockBuilder(FacetSourcePluginManager::class)
    ->disableOriginalConstructor()
    ->getMock();
  $manager
    ->expects($this
    ->exactly(1))
    ->method('createInstance')
    ->willReturn($url_processor);
  $storage = $this
    ->createMock(EntityStorageInterface::class);
  $em = $this
    ->getMockBuilder(EntityTypeManagerInterface::class)
    ->disableOriginalConstructor()
    ->getMock();
  $em
    ->expects($this
    ->exactly(1))
    ->method('getStorage')
    ->willReturn($storage);
  $container = new ContainerBuilder();
  $container
    ->set('entity_type.manager', $em);
  $container
    ->set('plugin.manager.facets.url_processor', $manager);
  \Drupal::setContainer($container);
}