function ViewExecutableTest::setUp
Same name and namespace in other branches
- 11.x core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::setUp()
- 10 core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::setUp()
- 9 core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::setUp()
- 8.9.x 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 139
Class
Namespace
Drupal\Tests\views\UnitCode
protected function setUp() : void {
parent::setUp();
$this->view = $this->createStub(ViewEntityInterface::class);
$this->user = $this->createStub(AccountInterface::class);
$this->viewsData = $this->createStub(ViewsData::class);
$this->displayHandler = $this->createStub(DisplayRouterInterface::class);
$this->routeProvider = $this->createStub(RouteProviderInterface::class);
$this->displayHandlers = $this->createStub(DisplayPluginCollection::class);
$this->displayPluginManager = $this->createStub(ViewsPluginManager::class);
$this->executable = new ViewExecutable($this->view, $this->user, $this->viewsData, $this->routeProvider, $this->displayPluginManager);
$this->executable->display_handler = $this->displayHandler;
$this->executable->displayHandlers = $this->displayHandlers;
$this->viewExecutableFactory = $this->createStub(ViewExecutableFactory::class);
$module_handler = $this->createStub(ModuleHandlerInterface::class);
$success_cache = $this->prophesize(CachePluginBase::class);
$success_cache->cacheGet('results')
->willReturn(TRUE);
$this->successCache = $success_cache->reveal();
$this->cacheManager = $this->createStub(PluginManagerInterface::class);
$translation = $this->getStringTranslationStub();
$container = new ContainerBuilder();
$container->set('string_translation', $translation);
$container->set('views.executable', $this->viewExecutableFactory);
$container->set('module_handler', $module_handler);
$container->set('plugin.manager.views.cache', $this->cacheManager);
\Drupal::setContainer($container);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.