Skip to content

Commit

Permalink
Document how to run integration tests locally
Browse files Browse the repository at this point in the history
I am also replacing the commented out connection parameters in
phpunit.xml.dist with a link to this paragraph because they have
diverged from the one we use in the CI since f88dc28.
  • Loading branch information
greg0ire committed Apr 11, 2024
1 parent a527330 commit d5d4ed5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
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" />
</php>

<testsuites>
Expand Down

0 comments on commit d5d4ed5

Please sign in to comment.