protected function ViewExecutableTest::setUp in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::setUp()
Overrides UnitTestCase::setUp
File
- core/
modules/ views/ tests/ src/ Unit/ ViewExecutableTest.php, line 82 - Contains \Drupal\Tests\views\Unit\ViewExecutableTest.
Class
- ViewExecutableTest
- @coversDefaultClass \Drupal\views\ViewExecutable @group views
Namespace
Drupal\Tests\views\UnitCode
protected function setUp() {
parent::setUp();
$this->view = $this
->getMock('Drupal\\views\\ViewEntityInterface');
$this->user = $this
->getMock('Drupal\\Core\\Session\\AccountInterface');
$this->viewsData = $this
->getMockBuilder('Drupal\\views\\ViewsData')
->disableOriginalConstructor()
->getMock();
$this->displayHandler = $this
->getMockBuilder('Drupal\\views\\Plugin\\views\\display\\DisplayRouterInterface')
->disableOriginalConstructor()
->getMock();
$this->routeProvider = $this
->getMock('Drupal\\Core\\Routing\\RouteProviderInterface');
$this->displayHandlers = $this
->getMockBuilder('Drupal\\views\\DisplayPluginCollection')
->disableOriginalConstructor()
->getMock();
$this->executable = new ViewExecutable($this->view, $this->user, $this->viewsData, $this->routeProvider);
$this->executable->display_handler = $this->displayHandler;
$this->executable->displayHandlers = $this->displayHandlers;
$this->viewExecutableFactory = $this
->getMockBuilder('Drupal\\views\\ViewExecutableFactory')
->disableOriginalConstructor()
->getMock();
$translation = $this
->getStringTranslationStub();
$container = new ContainerBuilder();
$container
->set('string_translation', $translation);
$container
->set('views.executable', $this->viewExecutableFactory);
\Drupal::setContainer($container);
}