Skip to content

Conversation

vincentchalamon
Copy link
Contributor

@vincentchalamon vincentchalamon commented Sep 18, 2023

Q A
Branch? main
Tickets N/A
License MIT
Doc PR TODO

Creating fixtures on functional tests may send Mercure Update objects. Before executing the test calls, the developer should be able to reset the Mercure Hub:

public function testAsAdminUserICanUpdateABook(): void
{
    FooFactory::createOne();
    self::getMercureHub()->reset();    // <== this line resets the Mercure Hub

    $this->client->request(...);
    self::assertCount(1, self::getMercureMessages());
}
  • fix Mercure assertions to public to allow Mercure Hub reset
  • decorate Mercure Hub for test performance

@vincentchalamon vincentchalamon self-assigned this Sep 18, 2023
@vincentchalamon vincentchalamon marked this pull request as draft September 18, 2023 16:19
@vincentchalamon vincentchalamon removed the request for review from soyuka September 18, 2023 16:19
@vincentchalamon vincentchalamon marked this pull request as ready for review September 18, 2023 16:23
@vincentchalamon
Copy link
Contributor Author

vincentchalamon commented Sep 18, 2023

Currently the Mercure assertions are based on the TraceableHubRegistry only enabled with debug mode. I'm facing performance issues using debug mode on tests (Allowed memory size..., cf. https://github.com/api-platform/demo/actions/runs/6225295170/job/16895399919) on Doctrine and Apcu because of this debug mode.

I'm thinking about decorating the Mercure HubRegistry to create a custom one just for this use-case (tests), which avoid enabling the debug mode in tests.

WDYT @soyuka?

@vincentchalamon vincentchalamon mentioned this pull request Sep 18, 2023
18 tasks
@vincentchalamon vincentchalamon force-pushed the fix/mercure-test-assertions branch from 4a9af0e to 8165cab Compare September 18, 2023 17:39
@soyuka soyuka merged commit 828e429 into api-platform:main Sep 19, 2023
@vincentchalamon vincentchalamon deleted the fix/mercure-test-assertions branch September 19, 2023 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants