-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
Multiple clients in user test is deprecated, still present in documentation #12961
Comments
You need to shutdown the kernel. WebTestCase extends KernelTestCase, which provides a static method self::ensureKernelShutdown(). Call this before creating the clients. This is indeed still missing from the documentation. From stack |
@Voetloos FYI, I have moved the issue to the documentation repository as it seems that the changes need to be done there. |
ok fine, i want to start transacion before each test and then rollback on tearDown, it also described in Symfony docs - "use DAMA\DoctrineTestBundle\PHPUnit\PHPUnitExtension }" but this extension loads kernel of couse. |
Doesn't it make sense to reuse kernel instead of shutdown? |
Client (KernelBrowser) can be created only when there is no
Kernel(deprecation notice) ORM transaction can be done only when Kernel is
loaded so it is incompatible requirements and impossible to use built in
Client for REST API testing with resetting DB state each time(In tearDown
method) with transaction. I can’t believe that is Symfony 5 has no good way
to test API...
пн, 8 июня 2020 г. в 06:11, bravik <[email protected]>:
… Doesn't it make sense to reuse kernel instead of shutdown?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#12961 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABQIAKKQ5P3WNIQXACAHVBLRVRJFDANCNFSM4KJBNKKQ>
.
|
So, you cannot use several clients at the same time ? Creating one shuts down the other's kernel, making it unusable. |
Thank you for this issue. |
@carsonbot This is still an issue |
Thank you for this issue. |
@carsonbot This is still an issue |
Symfony 4.4 is EOM, so lets close here |
Symfony 4.4 may be EOM. But the issue still exists in Symfony 7. https://symfony.com/doc/current/testing/insulating_clients.html just doesn't work. |
@OskarStark why close if the docs are still wrong? |
Can you please send a PR? |
#13351 has been open forever |
Symfony version(s) affected: 4.4.0
Description
After upgrading to Symfony 4.4.0 I got the following deprecation warning:
Calling "Symfony\Bundle\FrameworkBundle\Test\WebTestCase::createClient()" while a kernel has been booted is deprecated since Symfony 4.4 and will throw in 5.0, ensure the kernel is shut down before calling the method.
However, I do the same as in the documentation (https://symfony.com/doc/current/testing/insulating_clients.html), this also gives the same deprecation warning. There is no clear alternative, is the documentation outdated or is this a bug?
How to reproduce
The text was updated successfully, but these errors were encountered: