Skip to content

Commit d64ba84

Browse files
authored
chore: symfony dev tests (#6805)
1 parent f251ed1 commit d64ba84

File tree

3 files changed

+2
-22
lines changed

3 files changed

+2
-22
lines changed

src/Symfony/Routing/Router.php

Lines changed: 1 addition & 8 deletions
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/.ignored-deprecations

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@
2929
%Since api-platform/core 3.4: Injecting the "ApiPlatform\\JsonSchema\\TypeFactoryInterface" inside "ApiPlatform\\JsonSchema\\SchemaFactory" is deprecated and "ApiPlatform\\JsonSchema\\TypeFactoryInterface" will be removed in 4.x.%
3030
%Since api-platform/core 3.4: Injecting the "ApiPlatform\\JsonSchema\\TypeFactoryInterface" inside "ApiPlatform\\OpenApi\\Factory\\OpenApiFactory" is deprecated and "ApiPlatform\\JsonSchema\\TypeFactoryInterface" will be removed in 4.x.%
3131
%Since api-platform/core 3.3: Use a "ApiPlatform\\State\\ProviderInterface" as first argument in "ApiPlatform\\Symfony\\EventListener\\QueryParameterValidateListener" instead of "ApiPlatform\\ParameterValidator\\ParameterValidator".%
32+
%Use quoteSingleIdentifier\(\) individually for each part of a qualified name instead.%

tests/Symfony/Routing/RouterTest.php

Lines changed: 0 additions & 14 deletions
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)