You are here

protected function ViewsTest::setUp in Drupal 9

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

Overrides UnitTestCase::setUp

File

core/modules/views/tests/src/Unit/ViewsTest.php, line 31

Class

ViewsTest
@coversDefaultClass \Drupal\views\Views @group views

Namespace

Drupal\Tests\views\Unit

Code

protected function setUp() : void {
  parent::setUp();
  $this->container = new ContainerBuilder();
  $user = $this
    ->createMock('Drupal\\Core\\Session\\AccountInterface');
  $request_stack = new RequestStack();
  $request_stack
    ->push(new Request());
  $views_data = $this
    ->getMockBuilder('Drupal\\views\\ViewsData')
    ->disableOriginalConstructor()
    ->getMock();
  $route_provider = $this
    ->createMock('Drupal\\Core\\Routing\\RouteProviderInterface');
  $this->container
    ->set('views.executable', new ViewExecutableFactory($user, $request_stack, $views_data, $route_provider));
  \Drupal::setContainer($this->container);
}