Skip to content

Commit 1b7fd9c

Browse files
committed
Merge 3.4
2 parents f19dd94 + d64ba84 commit 1b7fd9c

File tree

2 files changed

+1
-22
lines changed

2 files changed

+1
-22
lines changed

src/Symfony/Routing/Router.php

+1-8
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
namespace ApiPlatform\Symfony\Routing;
1515

1616
use ApiPlatform\Metadata\UrlGeneratorInterface;
17-
use Symfony\Component\HttpFoundation\Exception\RequestExceptionInterface;
1817
use Symfony\Component\HttpFoundation\Request;
19-
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
2018
use Symfony\Component\Routing\RequestContext;
2119
use Symfony\Component\Routing\RouteCollection;
2220
use Symfony\Component\Routing\RouterInterface;
@@ -75,12 +73,7 @@ public function match(string $pathInfo): array
7573
}
7674

7775
$request = Request::create($pathInfo, Request::METHOD_GET, [], [], [], ['HTTP_HOST' => $baseContext->getHost()]);
78-
try {
79-
$context = (new RequestContext())->fromRequest($request);
80-
} catch (RequestExceptionInterface) {
81-
throw new ResourceNotFoundException('Invalid request context.');
82-
}
83-
76+
$context = (new RequestContext())->fromRequest($request);
8477
$context->setPathInfo($pathInfo);
8578
$context->setScheme($baseContext->getScheme());
8679
$context->setHost($baseContext->getHost());

tests/Symfony/Routing/RouterTest.php

-14
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
use PHPUnit\Framework\TestCase;
1919
use Prophecy\Argument;
2020
use Prophecy\PhpUnit\ProphecyTrait;
21-
use Symfony\Component\Routing\Exception\ExceptionInterface as RoutingExceptionInterface;
2221
use Symfony\Component\Routing\RequestContext;
2322
use Symfony\Component\Routing\RouteCollection;
2423
use Symfony\Component\Routing\RouterInterface;
@@ -96,19 +95,6 @@ public function testMatch(): void
9695
$this->assertEquals(['bar'], $router->match('/app_dev.php/foo'));
9796
}
9897

99-
public function testMatchWithInvalidContext(): void
100-
{
101-
$this->expectException(RoutingExceptionInterface::class);
102-
$this->expectExceptionMessage('Invalid request context.');
103-
$context = new RequestContext('/app_dev.php', 'GET', 'localhost', 'https');
104-
105-
$mockedRouter = $this->prophesize(RouterInterface::class);
106-
$mockedRouter->getContext()->willReturn($context)->shouldBeCalled();
107-
108-
$router = new Router($mockedRouter->reveal());
109-
$router->match('28-01-2018 10:10');
110-
}
111-
11298
public function testMatchDuplicatedBaseUrl(): void
11399
{
114100
$context = new RequestContext('/app', 'GET', 'localhost', 'https');

0 commit comments

Comments
 (0)