function ViewExecutableTest::testGetUrlWithPlaceholdersAndWithoutArgsAndExceptionValue

Same name in other branches
  1. 9 core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::testGetUrlWithPlaceholdersAndWithoutArgsAndExceptionValue()
  2. 8.9.x core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::testGetUrlWithPlaceholdersAndWithoutArgsAndExceptionValue()
  3. 10 core/modules/views/tests/src/Unit/ViewExecutableTest.php \Drupal\Tests\views\Unit\ViewExecutableTest::testGetUrlWithPlaceholdersAndWithoutArgsAndExceptionValue()

@covers ::getUrl

File

core/modules/views/tests/src/Unit/ViewExecutableTest.php, line 275

Class

ViewExecutableTest
@coversDefaultClass \Drupal\views\ViewExecutable @group views

Namespace

Drupal\Tests\views\Unit

Code

public function testGetUrlWithPlaceholdersAndWithoutArgsAndExceptionValue() : void {
    $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());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.