You are here

public function UnroutedUrlTest::testCreateFromRequest in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/UnroutedUrlTest.php \Drupal\Tests\Core\UnroutedUrlTest::testCreateFromRequest()

Tests the createFromRequest method.

@covers ::createFromRequest

File

core/tests/Drupal/Tests/Core/UnroutedUrlTest.php, line 135

Class

UnroutedUrlTest
@coversDefaultClass \Drupal\Core\Url @group UrlTest

Namespace

Drupal\Tests\Core

Code

public function testCreateFromRequest() {
  $request = Request::create('/test-path');
  $this->router
    ->expects($this
    ->once())
    ->method('matchRequest')
    ->with($request)
    ->will($this
    ->throwException(new ResourceNotFoundException()));
  $this
    ->expectException(ResourceNotFoundException::class);
  Url::createFromRequest($request);
}