Codeception / module-symfony

Codeception module for testing apps using Symfony framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Symfony 6 support

codedge opened this issue · comments

Currently it is not possible to use the module with Symfony 6 as the reqs in composer.json only a Symfony 4 and 5.
Any plans to support Symfony 6?

Hi @codedge ,

So far there is no codeception/codeception release tagged with Symfony 6 support, that's our blocker right now.

Support has already been implemented in 5.0 branch but, 5.0.0 in turn is blocked by PHPUnit 10.0.0 which will probably be released next month.

According to this issue Codeception/Codeception#6294 I hope the 5.0 release is going to happen in the next days as PHPUnit seem to be out of scope for 5.0.

The last comment in that thread is a month old, we decided to keep waiting for PHPUnit 10 after that...

commented

Hello.
To support php 8 and symfony 6, two lines in the file src/Codeception/Module/Symfony/SessionAssertionsTrait.php need to be corrected:

  1. Replace the content of the "getCurrentSession()" method with return $this->grabService('session.factory')->createSession();
  2. In the amLoggedInAs function, you need to remove the second argument from the UsernamePasswordToken class so line 43 must looks like this $token = new UsernamePasswordToken($user, $firewallName, $user->getRoles());

So far, I've made these changes to my helper class. But I hope that you will add them to the module code.

@semaz Cool.
The tests in symfony-module-tests also need to be adapted, for example making the change to getCurrentSession() prints:

 Step  See in session "_security_main"
 Fail  No session attribute with name '_security_main'

it may be that this session variable has been renamed,
if you have time you can try to send PRs to add this support, I will be very attentive to review it, otherwise I'll do both myself.

commented

#157 Hi @TavoNiievez. I created first PR in my life)
Please review it.

It seems to be a special occasion, I'm glad that Codeception is the project that receives your first PR.
Friendly reminder: we have some contribution guides in case you want to learn more about our workflow and how module-symfony uses symfony-module-tests to perform tests.