function RouteSubscriberTest::setUp

Same name in other branches
  1. 9 core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php \Drupal\Tests\views\Unit\EventSubscriber\RouteSubscriberTest::setUp()
  2. 8.9.x core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php \Drupal\Tests\views\Unit\EventSubscriber\RouteSubscriberTest::setUp()
  3. 11.x 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

Class

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

Namespace

Drupal\Tests\views\Unit\EventSubscriber

Code

protected function setUp() : void {
    parent::setUp();
    $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')
        ->willReturn($this->viewStorage);
    $this->state = $this->createMock('\\Drupal\\Core\\State\\StateInterface');
    $this->routeSubscriber = new TestRouteSubscriber($this->entityTypeManager, $this->state);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.