-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Adapt documentation for multiple clients on WebTestCases #13351
base: 4.4
Are you sure you want to change the base?
Conversation
// ... | ||
public function testWithMultipleClients() | ||
{ | ||
self::ensureKernelShutdown(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This first shutdown is not really needed, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part of the documentation is for multiple clients, I thought it would be better to have some kind of patter and add the call prior to all client creations (which is not present on the examples of a single client) to show the main difference and easy the understanding of the mechanism.
But I am happy with it if you want me to remove it and/or add a comment about the need to add it only if there are new clients being create.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I opened #34507 a long time ago and proposed this solution on the docs. To be honest, feels weird to ask people to shut down the kernel before actually creating any client. And when you call createClient()
it is already shutting down any previous kernel on the bootKernel()
method.
I'll leave it up to the maintainers!
// ... | ||
public function testWithMultipleInsulatedClients() | ||
{ | ||
self::ensureKernelShutdown(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as my previous answer.
$harry->request('POST', '/say/sally/Hello'); | ||
$sally->request('GET', '/messages'); | ||
self::ensureKernelShutdown(); | ||
$sally = static::createClient(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of the second client? It's using the same parameters, same kernel etc as the one before. So you could just use the same client for both the following requests or not?
$harry = static::createClient();
self::ensureKernelShutdown();
$sally = static::createClient();
This also seems pretty strange. How does $harry
client still work when the kernel is shutdown?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this "works" because https://github.com/symfony/symfony/blob/829566cdea90a0be0231a15a229df2166868fce0/src/Symfony/Bundle/FrameworkBundle/KernelBrowser.php#L155
boots the kernel again. So harry starts a client and boots the kernel, then shutdown the kernel, then boot it again...
fixes #12961
Make documentation reflect changes made on 4.4 that allows only one client and require the usage of
Symfony\Bundle\FrameworkBundle\Test\WebTestCase::ensureKernelShutdown()
before creating new clients.