Skip to content

Add caution message about reset container on each request #16750

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

Merged
merged 5 commits into from
Oct 6, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,14 @@ This allows you to create all types of requests you can think of:
:ref:`framework.test <reference-framework-test>` option is enabled).
This means you can override the service entirely if you need to.

.. caution::

Before each request with the client, the client "resets" the container and recreates it from scratch.
That gives each request an "isolated" environment because each request will create new service objects.
But for example, when using the entity manager of Doctrine, all entities loaded with it are "lost"
when a new request is sent (because the entity manager was "reset"). You have to query again entities if you want
to have entities in "valid state".

Browsing the Site
.................

Expand Down Expand Up @@ -898,16 +906,16 @@ Response Assertions
Asserts the response format returned by the
:method:`Symfony\\Component\\HttpFoundation\\Response::getFormat` method
is the same as the expected value.
``assertResponseIsUnprocessable(string $message = '')``
``assertResponseIsUnprocessable(string $message = '')``
Asserts the response is unprocessable (HTTP status is 422)

.. versionadded:: 5.3

The ``assertResponseFormatSame()`` method was introduced in Symfony 5.3.

.. versionadded:: 5.4

The ``assertResponseIsUnprocessable()`` method was introduced in Symfony 5.4.
The ``assertResponseIsUnprocessable()`` method was introduced in Symfony 5.4.

Request Assertions
..................
Expand Down