function PathPluginBaseTest::setupContainer
Same name in other branches
- 9 core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\display\PathPluginBaseTest::setupContainer()
- 8.9.x core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\display\PathPluginBaseTest::setupContainer()
- 10 core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\display\PathPluginBaseTest::setupContainer()
Setup access plugin manager and config factory in the Drupal class.
1 call to PathPluginBaseTest::setupContainer()
- PathPluginBaseTest::setUp in core/
modules/ views/ tests/ src/ Unit/ Plugin/ display/ PathPluginBaseTest.php
File
-
core/
modules/ views/ tests/ src/ Unit/ Plugin/ display/ PathPluginBaseTest.php, line 64
Class
- PathPluginBaseTest
- @coversDefaultClass \Drupal\views\Plugin\views\display\PathPluginBase @group views
Namespace
Drupal\Tests\views\Unit\Plugin\displayCode
public function setupContainer() : void {
$this->accessPluginManager = $this->getMockBuilder('\\Drupal\\views\\Plugin\\ViewsPluginManager')
->disableOriginalConstructor()
->getMock();
$container = new ContainerBuilder();
$container->set('plugin.manager.views.access', $this->accessPluginManager);
$config = [
'views.settings' => [
'display_extenders' => [],
],
];
$container->set('config.factory', $this->getConfigFactoryStub($config));
$language = $this->createMock('\\Drupal\\Core\\Language\\LanguageInterface');
$language->expects($this->any())
->method('getId')
->willReturn('nl');
$language_manager = $this->getMockBuilder('Drupal\\Core\\Language\\LanguageManagerInterface')
->disableOriginalConstructor()
->getMock();
$language_manager->expects($this->any())
->method('getCurrentLanguage')
->willReturn($language);
$container->set('language_manager', $language_manager);
$cache = $this->getMockBuilder('Drupal\\Core\\Cache\\CacheBackendInterface')
->disableOriginalConstructor()
->getMock();
$cache->expects($this->any())
->method('get')
->willReturn([]);
$container->set('cache.data', $cache);
\Drupal::setContainer($container);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.