Skip to content

Symfony 6 support #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
codedge opened this issue Jan 3, 2022 · 7 comments · Fixed by #158
Closed

Symfony 6 support #152

codedge opened this issue Jan 3, 2022 · 7 comments · Fixed by #158
Assignees

Comments

@codedge
Copy link
Contributor

codedge commented Jan 3, 2022

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?

@TavoNiievez
Copy link
Member

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.

@TavoNiievez TavoNiievez self-assigned this Jan 3, 2022
@codedge
Copy link
Contributor Author

codedge commented Jan 17, 2022

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.

@TavoNiievez
Copy link
Member

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

@semaz
Copy link
Contributor

semaz commented May 9, 2022

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.

@TavoNiievez
Copy link
Member

@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.

@semaz
Copy link
Contributor

semaz commented May 10, 2022

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

@TavoNiievez
Copy link
Member

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.

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 a pull request may close this issue.

3 participants