From ae6daab3c0e68ebb9159d0e441cbf77ea9b7325e Mon Sep 17 00:00:00 2001 From: Vincent Chalamon <407859+vincentchalamon@users.noreply.github.com> Date: Mon, 21 Aug 2023 09:59:08 +0200 Subject: [PATCH] test: update api-platform/core dependency --- api/composer.json | 8 +------ api/composer.lock | 42 ++++++++++++++++-------------------- api/src/Entity/Review.php | 2 ++ api/tests/Api/ReviewTest.php | 3 --- 4 files changed, 22 insertions(+), 33 deletions(-) diff --git a/api/composer.json b/api/composer.json index 0085a0fa0..67bbd02b7 100644 --- a/api/composer.json +++ b/api/composer.json @@ -1,18 +1,12 @@ { "type": "project", "license": "MIT", - "repositories": [ - { - "type": "vcs", - "url": "git@github.com:vincentchalamon/core.git" - } - ], "require": { "php": ">=8.2", "ext-ctype": "*", "ext-iconv": "*", "ext-xml": "*", - "api-platform/core": "dev-demo", + "api-platform/core": "3.1.x-dev", "doctrine/doctrine-bundle": "^2.7", "doctrine/doctrine-migrations-bundle": "^3.2", "doctrine/orm": "^2.12", diff --git a/api/composer.lock b/api/composer.lock index 021b461f3..67613ab51 100644 --- a/api/composer.lock +++ b/api/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2947cff93e0b37a3ddb3109f97d6dc5e", + "content-hash": "51b61f485c4305effda0483967f341b4", "packages": [ { "name": "api-platform/core", - "version": "dev-demo", + "version": "3.1.x-dev", "source": { "type": "git", - "url": "https://github.com/vincentchalamon/core.git", - "reference": "d6c3019671c7d668fa0cc8a624fc5bc17a26ddd2" + "url": "https://github.com/api-platform/core.git", + "reference": "a774f4c51167dbbe585269f14a7c51a3f9e38c3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vincentchalamon/core/zipball/d6c3019671c7d668fa0cc8a624fc5bc17a26ddd2", - "reference": "d6c3019671c7d668fa0cc8a624fc5bc17a26ddd2", + "url": "https://api.github.com/repos/api-platform/core/zipball/a774f4c51167dbbe585269f14a7c51a3f9e38c3c", + "reference": "a774f4c51167dbbe585269f14a7c51a3f9e38c3c", "shasum": "" }, "require": { @@ -139,12 +139,7 @@ "ApiPlatform\\": "src/" } }, - "autoload-dev": { - "psr-4": { - "ApiPlatform\\Tests\\": "tests/", - "App\\": "tests/Fixtures/app/var/tmp/src/" - } - }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -158,26 +153,27 @@ "description": "Build a fully-featured hypermedia or GraphQL API in minutes!", "homepage": "https://api-platform.com", "keywords": [ - "API", - "GraphQL", - "HAL", "Hydra", "JSON-LD", - "JSONAPI", - "OpenAPI", - "REST", - "Swagger" + "api", + "graphql", + "hal", + "jsonapi", + "openapi", + "rest", + "swagger" ], "support": { - "source": "https://github.com/vincentchalamon/core/tree/demo" + "issues": "https://github.com/api-platform/core/issues", + "source": "https://github.com/api-platform/core/tree/3.1" }, "funding": [ { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/packagist/api-platform/core" + "url": "https://tidelift.com/funding/github/packagist/api-platform/core", + "type": "tidelift" } ], - "time": "2023-08-08T18:08:58+00:00" + "time": "2023-08-23T07:41:20+00:00" }, { "name": "brick/math", diff --git a/api/src/Entity/Review.php b/api/src/Entity/Review.php index 3a60a8c20..d89f954f2 100644 --- a/api/src/Entity/Review.php +++ b/api/src/Entity/Review.php @@ -14,6 +14,7 @@ use ApiPlatform\Metadata\Patch; use ApiPlatform\Metadata\Post; use ApiPlatform\Metadata\Put; +use ApiPlatform\State\CreateProvider; use App\Repository\ReviewRepository; use App\Serializer\IriTransformerNormalizer; use App\State\Processor\ReviewPersistProcessor; @@ -86,6 +87,7 @@ security: 'is_granted("ROLE_USER")', // Mercure publish is done manually in MercureProcessor through ReviewPersistProcessor processor: ReviewPersistProcessor::class, + provider: CreateProvider::class, itemUriTemplate: '/books/{bookId}/reviews/{id}{._format}' ), new Patch( diff --git a/api/tests/Api/ReviewTest.php b/api/tests/Api/ReviewTest.php index 4faa69b1b..b0fd2502c 100644 --- a/api/tests/Api/ReviewTest.php +++ b/api/tests/Api/ReviewTest.php @@ -135,7 +135,6 @@ public function testAsAnonymousICannotAddAReviewOnABook(): void $this->client->request('POST', '/books/'.$book->getId().'/reviews', [ 'json' => [ - 'book' => '/books/'.$book->getId(), 'body' => 'Very good book!', 'rating' => 5, ], @@ -239,7 +238,6 @@ public function testAsAUserICannotAddAReviewWithValidDataOnAnInvalidBook(): void $this->client->request('POST', '/books/invalid/reviews', [ 'auth_bearer' => $token, 'json' => [ - 'book' => '/books/'.$book->getId(), 'body' => 'Very good book!', 'rating' => 5, ], @@ -272,7 +270,6 @@ public function testAsAUserICanAddAReviewOnABook(): void $response = $this->client->request('POST', '/books/'.$book->getId().'/reviews', [ 'auth_bearer' => $token, 'json' => [ - 'book' => '/books/'.$book->getId(), 'body' => 'Very good book!', 'rating' => 5, ],