Skip to content

Commit d29b7b6

Browse files
committed
Merge 3.2
2 parents 8e253d4 + e32a4c7 commit d29b7b6

File tree

7 files changed

+130
-48
lines changed

7 files changed

+130
-48
lines changed

.github/workflows/ci.yml

+36-1
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,46 @@ jobs:
8383
php-version: ${{ matrix.php }}
8484
extensions: intl, bcmath, curl, openssl, mbstring, mongodb
8585
ini-values: memory_limit=-1
86-
tools: pecl, composer, php-cs-fixer
86+
tools: php-cs-fixer
8787
coverage: none
8888
- name: Run PHP-CS-Fixer fix
8989
run: php-cs-fixer fix --dry-run --diff --ansi
9090

91+
lint-container:
92+
name: Lint Container
93+
runs-on: ubuntu-latest
94+
timeout-minutes: 20
95+
strategy:
96+
matrix:
97+
php:
98+
- '8.3'
99+
fail-fast: false
100+
steps:
101+
- name: Checkout
102+
uses: actions/checkout@v4
103+
- name: Setup PHP
104+
uses: shivammathur/setup-php@v2
105+
with:
106+
php-version: ${{ matrix.php }}
107+
extensions: intl, bcmath, curl, openssl, mbstring, mongodb
108+
ini-values: memory_limit=-1
109+
tools: composer
110+
coverage: none
111+
- name: Get composer cache directory
112+
id: composercache
113+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
114+
- name: Cache dependencies
115+
uses: actions/cache@v4
116+
with:
117+
path: ${{ steps.composercache.outputs.dir }}
118+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
119+
restore-keys: ${{ runner.os }}-composer-
120+
- name: Update project dependencies
121+
run: |
122+
composer update --no-interaction --no-progress --ansi
123+
- name: Run container lint
124+
run: tests/Fixtures/app/console lint:container
125+
91126
phpstan:
92127
name: PHPStan (PHP ${{ matrix.php }})
93128
runs-on: ubuntu-latest

CHANGELOG.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,14 @@ api_platform:
200200
form: ['multipart/form-data']
201201
```
202202

203+
## v3.2.24
204+
205+
### Bug fixes
206+
207+
* [451d50e53](https://github.com/api-platform/core/commit/451d50e538a4f7aac67d47601fee5474af99c870) fix(symfony): deprecations 7.1
208+
* [93e71eb82](https://github.com/api-platform/core/commit/93e71eb822aa06db2b6de303039f9b8c65cad7a8) fix(graphql): name converter with class (#6396)
209+
* [99314bf80](https://github.com/api-platform/core/commit/99314bf80e7c61147fb311da6403b37be5eab5b2) fix(state): handle empty request in read provider (#6403)
210+
203211
## v3.2.23
204212

205213
### Bug fixes
@@ -2316,4 +2324,4 @@ Please read #2825 if you have issues with the behavior of Readable/Writable Link
23162324
## 1.0.0 beta 2
23172325

23182326
* Preserve indexes when normalizing and denormalizing associative arrays
2319-
* Allow setting default order for property when registering a `Doctrine\Orm\Filter\OrderFilter` instance
2327+
* Allow setting default order for property when registering a `Doctrine\Orm\Filter\OrderFilter` instance

docs/guides/subresource.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Company
7575
function request(): Request
7676
{
7777
// Persistence is automatic, you can try to create or read data:
78-
return Request::create('/company/1/employees', 'GET');
78+
return Request::create('/companies/1/employees', 'GET');
7979
}
8080
}
8181

tests/Behat/MercureContext.php

+10-5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
namespace ApiPlatform\Tests\Behat;
1515

16+
use ApiPlatform\Tests\Fixtures\TestBundle\Mercure\TestHub;
1617
use Behat\Behat\Context\Context;
1718
use Behat\Gherkin\Node\PyStringNode;
1819
use Behat\Gherkin\Node\TableNode;
@@ -37,7 +38,7 @@ public function __construct(private readonly ContainerInterface $driverContainer
3738
*/
3839
public function mercureUpdatesShouldHaveBeenSent(int $number): void
3940
{
40-
$updateHandler = $this->driverContainer->get('mercure.hub.default.message_handler');
41+
$updateHandler = $this->getMercureTestHub();
4142
$total = \count($updateHandler->getUpdates());
4243

4344
if (0 === $total) {
@@ -70,7 +71,7 @@ public function firstMercureUpdateShouldHaveData(PyStringNode $data): void
7071
*/
7172
public function mercureUpdateShouldHaveTopics(int $index, TableNode $table): void
7273
{
73-
$updateHandler = $this->driverContainer->get('mercure.hub.default.message_handler');
74+
$updateHandler = $this->getMercureTestHub();
7475
$updates = $updateHandler->getUpdates();
7576

7677
if (0 === \count($updates)) {
@@ -90,7 +91,7 @@ public function mercureUpdateShouldHaveTopics(int $index, TableNode $table): voi
9091
*/
9192
public function mercureUpdateShouldHaveData(int $index, PyStringNode $data): void
9293
{
93-
$updateHandler = $this->driverContainer->get('mercure.hub.default.message_handler');
94+
$updateHandler = $this->getMercureTestHub();
9495
$updates = $updateHandler->getUpdates();
9596

9697
if (0 === \count($updates)) {
@@ -113,8 +114,7 @@ public function theFollowingMercureUpdateShouldHaveBeenSent(string $topics, PySt
113114
$topics = explode(',', $topics);
114115
$update = json_decode($update->getRaw(), true, 512, \JSON_THROW_ON_ERROR);
115116

116-
$updateHandler = $this->driverContainer->get('mercure.hub.default.message_handler');
117-
117+
$updateHandler = $this->getMercureTestHub();
118118
foreach ($updateHandler->getUpdates() as $sentUpdate) {
119119
$toMatchTopics = \count($topics);
120120
foreach ($sentUpdate->getTopics() as $sentTopic) {
@@ -136,4 +136,9 @@ public function theFollowingMercureUpdateShouldHaveBeenSent(string $topics, PySt
136136

137137
throw new \RuntimeException('Mercure update has not been sent.');
138138
}
139+
140+
private function getMercureTestHub(): TestHub
141+
{
142+
return $this->driverContainer->get('mercure.hub.default.test_hub');
143+
}
139144
}

tests/Fixtures/DummyMercureUpdateHandler.php

-36
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the API Platform project.
5+
*
6+
* (c) Kévin Dunglas <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace ApiPlatform\Tests\Fixtures\TestBundle\Mercure;
15+
16+
use Symfony\Component\Mercure\HubInterface;
17+
use Symfony\Component\Mercure\Jwt\TokenFactoryInterface;
18+
use Symfony\Component\Mercure\Jwt\TokenProviderInterface;
19+
use Symfony\Component\Mercure\Update;
20+
21+
final class TestHub implements HubInterface
22+
{
23+
/**
24+
* @var Update[]
25+
*/
26+
private array $updates = [];
27+
28+
public function __construct(private readonly HubInterface $hub)
29+
{
30+
}
31+
32+
/**
33+
* @return array<Update>
34+
*/
35+
public function getUpdates(): array
36+
{
37+
return $this->updates;
38+
}
39+
40+
public function getUrl(): string
41+
{
42+
return $this->hub->getUrl();
43+
}
44+
45+
public function getPublicUrl(): string
46+
{
47+
return $this->hub->getPublicUrl();
48+
}
49+
50+
public function getProvider(): TokenProviderInterface
51+
{
52+
return $this->hub->getProvider();
53+
}
54+
55+
public function getFactory(): ?TokenFactoryInterface
56+
{
57+
return $this->hub->getFactory();
58+
}
59+
60+
public function publish(Update $update): string
61+
{
62+
$this->updates[] = $update;
63+
64+
return $this->hub->publish($update);
65+
}
66+
}

tests/Fixtures/app/config/config_common.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ mercure:
2727
default:
2828
url: '%env(MERCURE_URL)%'
2929
jwt: '%env(MERCURE_JWT_SECRET)%'
30+
debug:
31+
url: '%env(MERCURE_URL)%'
32+
jwt: '%env(MERCURE_JWT_SECRET)%'
3033

3134
api_platform:
3235
title: 'My Dummy API'
@@ -252,11 +255,12 @@ services:
252255
tags:
253256
- name: 'api_platform.validation_groups_generator'
254257

255-
mercure.hub.default.message_handler:
256-
class: ApiPlatform\Tests\Fixtures\DummyMercureUpdateHandler
258+
mercure.hub.default.test_hub:
259+
class: ApiPlatform\Tests\Fixtures\TestBundle\Mercure\TestHub
260+
arguments:
261+
$hub: '@mercure.hub.debug'
257262
public: true
258-
tags: ['messenger.message_handler']
259-
mercure.hub.default.publisher: '@mercure.hub.default.message_handler'
263+
mercure.hub.default: '@mercure.hub.default.test_hub'
260264

261265
ApiPlatform\Tests\Fixtures\TestBundle\State\RecoverPasswordProcessor:
262266
tags:

0 commit comments

Comments
 (0)