You are here

protected function RouteSubscriberTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php \Drupal\Tests\views\Unit\EventSubscriber\RouteSubscriberTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php, line 51
Contains \Drupal\Tests\views\Unit\EventSubscriber\RouteSubscriberTest.

Class

RouteSubscriberTest
@coversDefaultClass \Drupal\views\EventSubscriber\RouteSubscriber @group views

Namespace

Drupal\Tests\views\Unit\EventSubscriber

Code

protected function setUp() : void {
  $this->entityTypeManager = $this
    ->createMock(EntityTypeManagerInterface::class);
  $this->viewStorage = $this
    ->getMockBuilder('Drupal\\Core\\Config\\Entity\\ConfigEntityStorage')
    ->disableOriginalConstructor()
    ->getMock();
  $this->entityTypeManager
    ->expects($this
    ->any())
    ->method('getStorage')
    ->with('view')
    ->will($this
    ->returnValue($this->viewStorage));
  $this->state = $this
    ->createMock('\\Drupal\\Core\\State\\StateInterface');
  $this->routeSubscriber = new TestRouteSubscriber($this->entityTypeManager, $this->state);
}