Skip to content

Mention the DoctrineTestBundle for tests that interact with the database #10026

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 1 commit into from
Jul 9, 2018
Merged
Changes from all commits
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
10 changes: 10 additions & 0 deletions testing/database.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ your test always has the same data to work with.

If you want to test your queries directly, see :doc:`/testing/doctrine`.

.. tip::

A popular technique to improve the performance of tests that interact with
the database is to begin a transaction before every test and roll it back
after the test has finished. This makes it unnecessary to recreate the
database or reload fixtures before every test. A community bundle called
`DoctrineTestBundle`_ provides this feature.

Mocking the ``Repository`` in a Unit Test
-----------------------------------------

Expand Down Expand Up @@ -150,3 +158,5 @@ configuration:

Make sure that your database runs on localhost and has the defined database and
user credentials set up.

.. _`DoctrineTestBundle`: https://github.com/dmaicher/doctrine-test-bundle