Skip to content

Conversation

@d-mitrofanov-v
Copy link
Contributor

Added assertions for notifier based on symfony NotificationAssertionsTrait

@d-mitrofanov-v d-mitrofanov-v marked this pull request as ready for review November 9, 2025 15:38
Copy link
Member

@TavoNiievez TavoNiievez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@d-mitrofanov-v Thank you for taking the time to add these new assertions!

All of these assertions were included in Symfony 6.2, and are not available in Symfony 5.4.

This module maintains the same support as the supported versions of Symfony, so we must ensure compatibility with Symfony 5.4 while it is still supported.

For a long time, I didn't think creating compatibility code was the most elegant option for this, which is why I kept putting off adding these assertions, but waiting until 2029 for SF 5.4 to become unsupported seems worse tbh.

So, Please add conditionals to each assertion to check that if the current version of Symfony is 5.4, you throw an exception explaining that these assertions are only available from SF 6.2 onwards (although in reality we only support 6.4+).

@TavoNiievez
Copy link
Member

You can use Symfony\Component\HttpKernel\Kernel::VERSION_ID to make this comparison, or use version_compare with Kernel::VERSION, both options are fine.

@d-mitrofanov-v
Copy link
Contributor Author

@TavoNiievez Thanks for review!

I've added check for a symfony version in getNotificationEvents() method as all assertions use it directly or indirectly

Copy link
Member

@TavoNiievez TavoNiievez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@TavoNiievez TavoNiievez merged commit f1b6bf1 into Codeception:main Nov 15, 2025
12 checks passed
@d-mitrofanov-v
Copy link
Contributor Author

@TavoNiievez Hi! Should we create a new release, so that these assertions would be available for everyone or is there something that is blocking the release?

@TavoNiievez
Copy link
Member

It is my job to verify that the code works in the three supported versions of Symfony in the test project before creating a release.

I had green tests with 7.3 and 6.4, but they failed in 5.4, which is when I wrote to you.

I still needed to cherry-pick your changes in the 5.4 branch and update dependencies to bring these changes over and verify that the tests ran well there.

Sorry for the delay.

@TavoNiievez
Copy link
Member

TavoNiievez commented Nov 27, 2025

@d-mitrofanov-v I just released version 3.8.0.

However, I would ask you to please send a PR targeting branch 5.4 in the test project so that you use a try catch with ExpectationFailedException to avoid getting failures in our CI flow.

The tests fail, and that is the expectation, but our CI should not report failures for this behavior.

@d-mitrofanov-v
Copy link
Contributor Author

@TavoNiievez Great, thanks! Here is the PR for 5.4

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