From fc96c6a672ef28ee18738572f1eab59bd7249afe Mon Sep 17 00:00:00 2001 From: Joseph Martell Date: Wed, 23 Feb 2022 00:40:51 +0100 Subject: [PATCH] Fix unit tests Update composer packages --- composer.json | 4 ++-- tests/GenerateHttpTest.php | 6 +++++- tests/PathMethodBuilderTest.php | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 789c2e0..31248ac 100644 --- a/composer.json +++ b/composer.json @@ -14,8 +14,8 @@ ], "require": { "php": ">=8.0", - "symfony/finder": "^5.3", - "symfony/http-foundation": "^5.3" + "symfony/finder": "^6.0", + "symfony/http-foundation": "^6.0" }, "autoload": { "psr-4": { diff --git a/tests/GenerateHttpTest.php b/tests/GenerateHttpTest.php index ce37600..1e344c3 100644 --- a/tests/GenerateHttpTest.php +++ b/tests/GenerateHttpTest.php @@ -6,6 +6,7 @@ use OpenApiGenerator\Attributes\GET; use OpenApiGenerator\Attributes\Parameter; +use OpenApiGenerator\Attributes\PathParameter; use OpenApiGenerator\Attributes\Property; use OpenApiGenerator\Attributes\RequestBody; use OpenApiGenerator\Attributes\Response; @@ -34,13 +35,16 @@ public function testAppend(): void $expectedParameter->setName('id'); $expectedParameter->setParamType('float'); + $expectedPathParameter = new PathParameter('otherParameter', description: 'Parameter which is not used as an argument in this method'); + $schema = new Schema(); $schema->addProperty(new Property('string', 'prop1')); $requestBody = new RequestBody(); $requestBody->setSchema($schema); - $expectedRoute = new GET('/path/{id}', ['Dummy'], 'Dummy path'); + $expectedRoute = new GET('/path/{id}/{otherParameter}', ['Dummy'], 'Dummy path'); $expectedRoute->addParam($expectedParameter); + $expectedRoute->addParam($expectedPathParameter); $expectedRoute->setRequestBody($requestBody); $expectedRoute->setResponse(new Response()); diff --git a/tests/PathMethodBuilderTest.php b/tests/PathMethodBuilderTest.php index af10e42..d22f5b1 100644 --- a/tests/PathMethodBuilderTest.php +++ b/tests/PathMethodBuilderTest.php @@ -155,7 +155,7 @@ public function testSetRoute(): void $route = new Route(Route::GET, "/path"); $builder = new PathMethodBuilder(); - $builder->setRoute($route, [[new Parameter("desc")]]); + $builder->setRoute($route, [new Parameter("desc")]); // Use a reflection to avoid testing PathMethodBuilder::getRoute $reflection = new ReflectionClass($builder);