Skip to content

Commit

Permalink
Merge 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka committed Jun 14, 2024
2 parents 8e253d4 + e32a4c7 commit d29b7b6
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 48 deletions.
37 changes: 36 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,46 @@ jobs:
php-version: ${{ matrix.php }}
extensions: intl, bcmath, curl, openssl, mbstring, mongodb
ini-values: memory_limit=-1
tools: pecl, composer, php-cs-fixer
tools: php-cs-fixer
coverage: none
- name: Run PHP-CS-Fixer fix
run: php-cs-fixer fix --dry-run --diff --ansi

lint-container:
name: Lint Container
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
php:
- '8.3'
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: intl, bcmath, curl, openssl, mbstring, mongodb
ini-values: memory_limit=-1
tools: composer
coverage: none
- name: Get composer cache directory
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Update project dependencies
run: |
composer update --no-interaction --no-progress --ansi
- name: Run container lint
run: tests/Fixtures/app/console lint:container

phpstan:
name: PHPStan (PHP ${{ matrix.php }})
runs-on: ubuntu-latest
Expand Down
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ api_platform:
form: ['multipart/form-data']
```

## v3.2.24

### Bug fixes

* [451d50e53](https://github.com/api-platform/core/commit/451d50e538a4f7aac67d47601fee5474af99c870) fix(symfony): deprecations 7.1
* [93e71eb82](https://github.com/api-platform/core/commit/93e71eb822aa06db2b6de303039f9b8c65cad7a8) fix(graphql): name converter with class (#6396)
* [99314bf80](https://github.com/api-platform/core/commit/99314bf80e7c61147fb311da6403b37be5eab5b2) fix(state): handle empty request in read provider (#6403)

## v3.2.23

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

* Preserve indexes when normalizing and denormalizing associative arrays
* Allow setting default order for property when registering a `Doctrine\Orm\Filter\OrderFilter` instance
* Allow setting default order for property when registering a `Doctrine\Orm\Filter\OrderFilter` instance
2 changes: 1 addition & 1 deletion docs/guides/subresource.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Company
function request(): Request
{
// Persistence is automatic, you can try to create or read data:
return Request::create('/company/1/employees', 'GET');
return Request::create('/companies/1/employees', 'GET');
}
}

Expand Down
15 changes: 10 additions & 5 deletions tests/Behat/MercureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace ApiPlatform\Tests\Behat;

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

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

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

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

$updateHandler = $this->driverContainer->get('mercure.hub.default.message_handler');

$updateHandler = $this->getMercureTestHub();
foreach ($updateHandler->getUpdates() as $sentUpdate) {
$toMatchTopics = \count($topics);
foreach ($sentUpdate->getTopics() as $sentTopic) {
Expand All @@ -136,4 +136,9 @@ public function theFollowingMercureUpdateShouldHaveBeenSent(string $topics, PySt

throw new \RuntimeException('Mercure update has not been sent.');
}

private function getMercureTestHub(): TestHub
{
return $this->driverContainer->get('mercure.hub.default.test_hub');
}
}
36 changes: 0 additions & 36 deletions tests/Fixtures/DummyMercureUpdateHandler.php

This file was deleted.

66 changes: 66 additions & 0 deletions tests/Fixtures/TestBundle/Mercure/TestHub.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php

/*
* This file is part of the API Platform project.
*
* (c) Kévin Dunglas <dunglas@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace ApiPlatform\Tests\Fixtures\TestBundle\Mercure;

use Symfony\Component\Mercure\HubInterface;
use Symfony\Component\Mercure\Jwt\TokenFactoryInterface;
use Symfony\Component\Mercure\Jwt\TokenProviderInterface;
use Symfony\Component\Mercure\Update;

final class TestHub implements HubInterface
{
/**
* @var Update[]
*/
private array $updates = [];

public function __construct(private readonly HubInterface $hub)
{
}

/**
* @return array<Update>
*/
public function getUpdates(): array
{
return $this->updates;
}

public function getUrl(): string
{
return $this->hub->getUrl();
}

public function getPublicUrl(): string
{
return $this->hub->getPublicUrl();
}

public function getProvider(): TokenProviderInterface
{
return $this->hub->getProvider();
}

public function getFactory(): ?TokenFactoryInterface
{
return $this->hub->getFactory();
}

public function publish(Update $update): string
{
$this->updates[] = $update;

return $this->hub->publish($update);
}
}
12 changes: 8 additions & 4 deletions tests/Fixtures/app/config/config_common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ mercure:
default:
url: '%env(MERCURE_URL)%'
jwt: '%env(MERCURE_JWT_SECRET)%'
debug:
url: '%env(MERCURE_URL)%'
jwt: '%env(MERCURE_JWT_SECRET)%'

api_platform:
title: 'My Dummy API'
Expand Down Expand Up @@ -252,11 +255,12 @@ services:
tags:
- name: 'api_platform.validation_groups_generator'

mercure.hub.default.message_handler:
class: ApiPlatform\Tests\Fixtures\DummyMercureUpdateHandler
mercure.hub.default.test_hub:
class: ApiPlatform\Tests\Fixtures\TestBundle\Mercure\TestHub
arguments:
$hub: '@mercure.hub.debug'
public: true
tags: ['messenger.message_handler']
mercure.hub.default.publisher: '@mercure.hub.default.message_handler'
mercure.hub.default: '@mercure.hub.default.test_hub'

ApiPlatform\Tests\Fixtures\TestBundle\State\RecoverPasswordProcessor:
tags:
Expand Down

0 comments on commit d29b7b6

Please sign in to comment.