/** * @covers ::getUrl */ public function testGetUrlWithPlaceholdersAndWithoutArgsAndExceptionValue() { $this->displayHandler->expects($this->any())->method('getRoutedDisplay')->willReturn($this->displayHandler); $this->displayHandlers->expects($this->any())->method('get')->willReturn($this->displayHandler); $this->displayHandler->expects($this->any())->method('getUrlInfo')->willReturn(Url::fromRoute('views.test.page_1')); $this->displayHandler->expects($this->any())->method('getPath')->willReturn('test-path/%/%'); $route = new Route('/test-path/{arg_0}/{arg_1}'); $this->routeProvider->expects($this->any())->method('getRouteByName')->with('views.test.page_1')->willReturn($route); $argument_handler = $this->getMockBuilder('Drupal\\views\\Plugin\\views\\argument\\ArgumentPluginBase')->disableOriginalConstructor()->getMock(); $argument_handler->options['exception']['value'] = 'exception_0'; $this->executable->argument['key_1'] = $argument_handler; $argument_handler = $this->getMockBuilder('Drupal\\views\\Plugin\\views\\argument\\ArgumentPluginBase')->disableOriginalConstructor()->getMock(); $argument_handler->options['exception']['value'] = 'exception_1'; $this->executable->argument['key_2'] = $argument_handler; $this->assertEquals(Url::fromRoute('views.test.page_1', ['arg_0' => 'exception_0', 'arg_1' => 'exception_1']), $this->executable->getUrl()); }
/** * Removes configuration for a handler instance on a given display. * * @param string $display_id * The machine name of the display. * @param string $type * The type of handler being removed. * @param string $id * The ID of the handler being removed. */ public function removeHandler($display_id, $type, $id) { // Get info about the types so we can get the right data. $types = static::getHandlerTypes(); // Initialize the display. $this->setDisplay($display_id); // Get the existing configuration. $fields = $this->displayHandlers->get($display_id)->getOption($types[$type]['plural']); // Unset the item. unset($fields[$id]); // Store. $this->displayHandlers->get($display_id)->setOption($types[$type]['plural'], $fields); }