-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Update testing.rst #6447
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
Update testing.rst #6447
Conversation
Hello, I'm working with some test in a Symfony 2.3 application. Reading the docs, they say that "If your requests are not insulated, you can also access the Container and the Kernel", but I can access kernel and container even in an insulated $client doing this: $client = $this->createClient(); $client->insulate(true); $crawler = $client->request('GET', '/'); $container = $client->getContainer(); $kernel = $client->getKernel(); var_dump($kernel->getBundles());
Well, the thing is that the kernel and the container used in the insulated process is not the same that you get access to with |
Ok, I understand. Perhaps we can clarify this point. In this moment, the "if your request are not insulated, you can also access the Container and the Kernel" phrase, sounds to me as if I couldn't access the kernel/container from and insulated client. Possibly we can explain that the kernel/container retrieved in this context is different. Thanks. |
@miguelvilata Sounds like a good idea. Can you make that change? |
Of course, I'll try. Give some time to make a proposal. |
@miguelvilata Do you have some idea on how to make things more clear? :) |
Sorry for the delay. What do you think about replace ping: @xabbuh |
Can I do something more to improve this contribution? |
Thinking about this again I would keep the existing sentence as is, but add something like "for insulated requests the returned instances are not the same that were used in the request" in parentheses after it. What do you think? |
There's also some duplication - the next section talks about getting the container and it also has a comment about insulation (https://github.com/miguelvilata/symfony-docs/blob/5dafbb105f9ad71afa336ce65acfbea2f9bf1f15/book/testing.rst#accessing-the-container). I think we should:
// will be the same container used in your test, unless you're using $client->insulate()
// or using real HTTP requests to test your app
$container = $client->getContainer(); |
@miguelvilata thanks for proposing this improvement. As you know, we recently revamped the Symfony Docs. For that reason, this PR can no longer be merged. I've recreated your work in #6834 and added the suggestions made by Ryan. Thank you all for the discussion! |
Thanks @miguelvilata for your work on this. |
Hello, I'm working with some test in a Symfony 2.3 application. Reading the docs, they say that "If your requests are not insulated, you can also access the Container and the Kernel", but I can access kernel and container even in an insulated $client doing this: