Skip to content

Commit

Permalink
chore: check API Platform 4.1 (#500)
Browse files Browse the repository at this point in the history
Fixes #506
  • Loading branch information
vincentchalamon authored Feb 28, 2025
1 parent e880613 commit 848a763
Show file tree
Hide file tree
Showing 12 changed files with 1,298 additions and 1,375 deletions.
8 changes: 4 additions & 4 deletions api/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"php": ">=8.3",
"ext-ctype": "*",
"ext-iconv": "*",
"api-platform/doctrine-orm": "^4.0.18",
"api-platform/graphql": "^4.0.18",
"api-platform/symfony": "^4.0.18",
"api-platform/doctrine-orm": "^4.1",
"api-platform/graphql": "^4.1",
"api-platform/symfony": "^4.1",
"doctrine/common": "^3.4",
"doctrine/doctrine-bundle": "^2.11",
"doctrine/doctrine-fixtures-bundle": "^4.0",
Expand Down Expand Up @@ -50,7 +50,7 @@
"phpstan/phpstan-doctrine": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-symfony": "^2.0",
"phpunit/phpunit": "^11.3",
"phpunit/phpunit": "^12.0",
"symfony/browser-kit": "7.2.*",
"symfony/css-selector": "7.2.*",
"symfony/debug-bundle": "7.2.*",
Expand Down
1,720 changes: 800 additions & 920 deletions api/composer.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions api/config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
api_platform:
title: API Platform's demo
version: 4.0.18
version: 4.1.0
description: |
This is a demo application of the [API Platform](https://api-platform.com) framework.
[Its source code](https://github.com/api-platform/demo) includes various examples, check it out!
Expand Down Expand Up @@ -50,19 +50,19 @@ services:
app.filter.review.admin.user:
parent: 'api_platform.doctrine.orm.search_filter'
arguments:
$properties: { user: 'exact' } ]
$properties: { user: 'exact' }
tags: [ 'api_platform.filter' ]

app.filter.review.admin.book:
parent: 'api_platform.doctrine.orm.search_filter'
arguments:
$properties: { book: 'exact' } ]
$properties: { book: 'exact' }
tags: [ 'api_platform.filter' ]

app.filter.review.admin.rating:
parent: 'api_platform.doctrine.orm.numeric_filter'
arguments:
$properties: { rating: ~ } ]
$properties: { rating: ~ }
tags: [ 'api_platform.filter' ]

# "name" is not a property, it's only a method "getName"
Expand All @@ -73,5 +73,5 @@ services:
$managerRegistry: '@doctrine'
$logger: '@logger'
$nameConverter: '@?api_platform.name_converter'
$properties: { name: 'ipartial' } ]
$properties: { name: 'ipartial' }
tags: [ 'api_platform.filter' ]
1 change: 1 addition & 0 deletions api/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,6 @@

<extensions>
<bootstrap class="DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension" />
<bootstrap class="Zenstruck\Foundry\PHPUnit\FoundryExtension"/>
</extensions>
</phpunit>
8 changes: 4 additions & 4 deletions api/tests/Api/Admin/BookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ public static function getInvalidDataOnCreate(): iterable
[],
Response::HTTP_UNPROCESSABLE_ENTITY,
[
'@type' => 'ConstraintViolationList',
'@type' => 'ConstraintViolation',
'title' => 'An error occurred',
'violations' => [
[
Expand All @@ -315,7 +315,7 @@ public static function getInvalidData(): iterable
],
Response::HTTP_UNPROCESSABLE_ENTITY,
[
'@type' => 'ConstraintViolationList',
'@type' => 'ConstraintViolation',
'title' => 'An error occurred',
'description' => 'condition: This value should be of type ' . BookCondition::class . '.',
'violations' => [
Expand All @@ -333,7 +333,7 @@ public static function getInvalidData(): iterable
],
Response::HTTP_UNPROCESSABLE_ENTITY,
[
'@type' => 'ConstraintViolationList',
'@type' => 'ConstraintViolation',
'title' => 'An error occurred',
'description' => 'condition: This value should be of type ' . BookCondition::class . '.',
'violations' => [
Expand All @@ -351,7 +351,7 @@ public static function getInvalidData(): iterable
],
Response::HTTP_UNPROCESSABLE_ENTITY,
[
'@type' => 'ConstraintViolationList',
'@type' => 'ConstraintViolation',
'title' => 'An error occurred',
'violations' => [
[
Expand Down
4 changes: 2 additions & 2 deletions api/tests/Api/BookmarkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function asAUserICannotCreateABookmarkWithInvalidData(): void
self::assertResponseHeaderSame('content-type', 'application/problem+json; charset=utf-8');
self::assertResponseHeaderSame('link', '<http://www.w3.org/ns/hydra/error>; rel="http://www.w3.org/ns/json-ld#error",<http://localhost/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"');
self::assertJsonContains([
'@type' => 'ConstraintViolationList',
'@type' => 'ConstraintViolation',
'title' => 'An error occurred',
'description' => 'book: This value should be of type ' . Book::class . '.',
'violations' => [
Expand Down Expand Up @@ -218,7 +218,7 @@ public function asAUserICannotCreateADuplicateBookmark(): void
self::assertResponseHeaderSame('content-type', 'application/problem+json; charset=utf-8');
self::assertResponseHeaderSame('link', '<http://www.w3.org/ns/hydra/error>; rel="http://www.w3.org/ns/json-ld#error",<http://localhost/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"');
self::assertJsonContains([
'@type' => 'ConstraintViolationList',
'@type' => 'ConstraintViolation',
'title' => 'An error occurred',
'description' => 'You have already bookmarked this book.',
]);
Expand Down
4 changes: 2 additions & 2 deletions api/tests/Api/ReviewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public static function getInvalidData(): iterable
[],
Response::HTTP_UNPROCESSABLE_ENTITY,
[
'@type' => 'ConstraintViolationList',
'@type' => 'ConstraintViolation',
'title' => 'An error occurred',
'violations' => [
[
Expand Down Expand Up @@ -325,7 +325,7 @@ public function asAUserICannotAddADuplicateReviewOnABook(): void
self::assertResponseHeaderSame('content-type', 'application/problem+json; charset=utf-8');
self::assertResponseHeaderSame('link', '<http://www.w3.org/ns/hydra/error>; rel="http://www.w3.org/ns/json-ld#error",<http://localhost/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"');
self::assertJsonContains([
'@type' => 'ConstraintViolationList',
'@type' => 'ConstraintViolation',
'title' => 'An error occurred',
'description' => 'You have already reviewed this book.',
]);
Expand Down
12 changes: 12 additions & 0 deletions api/tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

declare(strict_types=1);

use Faker\Factory as FakerFactory;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\ErrorHandler;
use Zenstruck\Foundry\Object\Instantiator;
use Zenstruck\Foundry\Test\UnitTestConfig;

require dirname(__DIR__) . '/vendor/autoload.php';

Expand All @@ -15,3 +19,11 @@
if ($_SERVER['APP_DEBUG']) {
umask(0000);
}

// https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#non-kernel-tests
UnitTestConfig::configure(instantiator: (Instantiator::withoutConstructor())
->allowExtra()
->alwaysForce(), faker: FakerFactory::create('en_GB'));

// https://github.com/symfony/symfony/issues/53812#issuecomment-1962740145
set_exception_handler([new ErrorHandler(), 'handleException']);
4 changes: 2 additions & 2 deletions helm/api-platform/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 4.0.18
version: 4.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 4.0.18
appVersion: 4.1.0

dependencies:
- name: postgresql
Expand Down
34 changes: 17 additions & 17 deletions pwa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@
"test": "playwright test"
},
"dependencies": {
"@api-platform/admin": "^4.0.3",
"@api-platform/api-doc-parser": "^0.16.6",
"@api-platform/admin": "^4.0.4",
"@api-platform/api-doc-parser": "^0.16.7",
"@auth/core": "^0.37.4",
"@fontsource/poppins": "^5.1.1",
"@mui/icons-material": "latest-v5",
"@mui/material": "latest-v5",
"@tailwindcss/forms": "^0.5.10",
"@tanstack/react-query": "^5.64.2",
"@tanstack/react-query-devtools": "^5.64.2",
"@tanstack/react-query-next-experimental": "^5.64.2",
"@tanstack/react-query": "^5.65.1",
"@tanstack/react-query-devtools": "^5.65.1",
"@tanstack/react-query-next-experimental": "^5.65.1",
"autoprefixer": "^10.4.20",
"formik": "^2.4.6",
"next": "^15.1.5",
"next": "^15.1.6",
"next-auth": "5.0.0-beta.25",
"picocolors": "^1.1.1",
"postcss": "^8.5.1",
"ra-i18n-polyglot": "^5.4.4",
"ra-language-english": "^5.4.4",
"ra-language-french": "^5.4.4",
"ra-ui-materialui": "^5.4.4",
"ra-i18n-polyglot": "^5.5.2",
"ra-language-english": "^5.5.2",
"ra-language-french": "^5.5.2",
"ra-ui-materialui": "^5.5.2",
"react": "^19.0.0",
"react-admin": "^5.4.4",
"react-admin": "^5.5.2",
"react-dom": "^19.0.0",
"react-hook-form": "^7.54.2",
"react-spinners": "^0.15.0",
Expand All @@ -41,14 +41,14 @@
"yup": "^1.6.1"
},
"devDependencies": {
"@babel/core": "^7.26.0",
"@playwright/test": "^1.49.1",
"@babel/core": "^7.26.7",
"@playwright/test": "^1.50.0",
"@popperjs/core": "^2.11.8",
"@types/node": "^22.10.7",
"@types/react": "^19.0.7",
"@types/node": "^22.12.0",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"eslint": "^9.18.0",
"eslint-config-next": "^15.1.5",
"eslint": "^9.19.0",
"eslint-config-next": "^15.1.6",
"typescript": "^5.7.3"
},
"packageManager": "pnpm@10.3.0"
Expand Down
Loading

0 comments on commit 848a763

Please sign in to comment.