protected function FieldPluginBaseTest::setUp in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/views/tests/src/Unit/Plugin/field/FieldPluginBaseTest.php \Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTest::setUp()
Overrides UnitTestCase::setUp
File
- core/
modules/ views/ tests/ src/ Unit/ Plugin/ field/ FieldPluginBaseTest.php, line 133 - Contains \Drupal\Tests\views\Unit\Plugin\field\FieldPluginBaseTest.
Class
- FieldPluginBaseTest
- @coversDefaultClass \Drupal\views\Plugin\views\field\FieldPluginBase @group views
Namespace
Drupal\Tests\views\Unit\Plugin\fieldCode
protected function setUp() {
parent::setUp();
$this->executable = $this
->getMockBuilder('Drupal\\views\\ViewExecutable')
->disableOriginalConstructor()
->getMock();
$this->display = $this
->getMockBuilder('Drupal\\views\\Plugin\\views\\display\\DisplayPluginBase')
->disableOriginalConstructor()
->getMock();
$route_provider = $this
->getMock('Drupal\\Core\\Routing\\RouteProviderInterface');
$route_provider
->expects($this
->any())
->method('getRouteByName')
->with('test_route')
->willReturn(new Route('/test-path'));
$this->urlGenerator = $this
->getMock('Drupal\\Core\\Routing\\UrlGeneratorInterface');
$this->pathValidator = $this
->getMock('Drupal\\Core\\Path\\PathValidatorInterface');
$this->requestStack = new RequestStack();
$this->requestStack
->push(new Request());
$this->unroutedUrlAssembler = $this
->getMock('Drupal\\Core\\Utility\\UnroutedUrlAssemblerInterface');
$this->linkGenerator = $this
->getMock('Drupal\\Core\\Utility\\LinkGeneratorInterface');
$this->renderer = $this
->getMock('Drupal\\Core\\Render\\RendererInterface');
$container_builder = new ContainerBuilder();
$container_builder
->set('url_generator', $this->urlGenerator);
$container_builder
->set('path.validator', $this->pathValidator);
$container_builder
->set('unrouted_url_assembler', $this->unroutedUrlAssembler);
$container_builder
->set('request_stack', $this->requestStack);
$container_builder
->set('renderer', $this->renderer);
\Drupal::setContainer($container_builder);
}