Skip to content

Document how to run integration tests locally #6355

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 2 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
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
13 changes: 0 additions & 13 deletions ci/travis/install-mariadb.sh

This file was deleted.

25 changes: 25 additions & 0 deletions docs/en/reference/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,31 @@ multiple concurrent database connections, transactions, locking, performance-rel
In such cases, it is still important that a pull request fixing the issues is accompanied by a free-form reproducer
that demonstrates the issue being fixed.

Running Integration Tests locally
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The default ``phpunit.xml.dist`` configuration file is set up to run the
integration tests against SQLite, but you need to enable the extension
``pdo_sqlite`` in your PHP configuration.

To run the integration tests against another platform, you can use one
of the configuration files used in our continuous integration setup.
Those are stored under ``ci/github/``.

For instance, to run tests against MySQL using the PDO driver, you
should spin up a MySQL server, enable the ``pdo_mysql`` extension, and
then run the following command:

.. code-block:: console

$ phpunit -c ci/github/pdo_mysql.xml

We do not currently have specific instructions on how to run a Database
server, but we do recommend Docker as a convenient way to do so.
We do not recommend running against a particular version of the chosen
RDBMS either, as long as you pick one of the
:doc:`officially supported versions <reference/platforms>`.

Recommendations on Writing Tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
21 changes: 4 additions & 17 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,11 @@
<php>
<ini name="error_reporting" value="-1" />

<!-- Test connection parameters -->
<!-- Uncomment, otherwise SQLite runs
<var name="db_driver" value="pdo_mysql"/>
<var name="db_host" value="localhost" />
<var name="db_port" value="3306"/>
<var name="db_user" value="root" />
<var name="db_password" value="" />
<var name="db_dbname" value="doctrine_tests" />
<!--
By default, the tests are run against SQLite.
If you want to run them against another DBMS,
see https://www.doctrine-project.org/projects/doctrine-dbal/en/stable/reference/testing.html#running-integration-tests-locally
-->
<!--<var name="db_event_subscribers" value="Doctrine\DBAL\Event\Listeners\OracleSessionInit">-->

<!-- Privileged user connection parameters. Used to create and drop the test database -->
<var name="tmpdb_driver" value="pdo_mysql"/>
<var name="tmpdb_host" value="localhost" />
<var name="tmpdb_port" value="3306"/>
<var name="tmpdb_user" value="root" />
<var name="tmpdb_password" value="" />
<var name="tmpdb_dbname" value="doctrine_tests_tmp" />
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another reason for this removal is a discussion with @alli83 about how to run the test suite, where I recommended either using a CI file or these instructions. She reported that the latter did not work (and the former works 🙂 ).

</php>

<testsuites>
Expand Down
Loading