function ViewsTest::setUp

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

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