Skip to content

Commit 82d3920

Browse files
committed
Document how to run integration tests locally
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.
1 parent a527330 commit 82d3920

File tree

2 files changed

+29
-17
lines changed

2 files changed

+29
-17
lines changed

docs/en/reference/testing.rst

+25
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,31 @@ multiple concurrent database connections, transactions, locking, performance-rel
6262
In such cases, it is still important that a pull request fixing the issues is accompanied by a free-form reproducer
6363
that demonstrates the issue being fixed.
6464

65+
Running Integration Tests locally
66+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
67+
68+
The default ``phpunit.xml.dist`` configuration file is set up to run the
69+
integration tests against SQLite, but you need to enable the extension
70+
``pdo_sqlite`` in your PHP configuration.
71+
72+
To run the integration tests against another platform, you can use one
73+
of the configuration files used in our continuous integration setup.
74+
Those are stored under ``ci/github/``.
75+
76+
For instance, to run tests against MySQL using the PDO driver, you
77+
should spin up a MySQL server, enable the ``pdo_mysql`` extension, and
78+
then run the following command:
79+
80+
.. code-block:: console
81+
82+
$ phpunit -c ci/github/pdo_mysql.xml
83+
84+
We do not currently have specific instructions on how to run a Database
85+
server, but we do recommend Docker as a convenient way to do so.
86+
We do not recommend running against a particular version of the chosen
87+
RDBMS either, as long as you pick one of the `officially supported versions
88+
<https://www.doctrine-project.org/projects/doctrine-dbal/en/4.0/reference/platforms.html>`_.
89+
6590
Recommendations on Writing Tests
6691
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6792

phpunit.xml.dist

+4-17
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,11 @@
2222
<php>
2323
<ini name="error_reporting" value="-1" />
2424

25-
<!-- Test connection parameters -->
26-
<!-- Uncomment, otherwise SQLite runs
27-
<var name="db_driver" value="pdo_mysql"/>
28-
<var name="db_host" value="localhost" />
29-
<var name="db_port" value="3306"/>
30-
<var name="db_user" value="root" />
31-
<var name="db_password" value="" />
32-
<var name="db_dbname" value="doctrine_tests" />
25+
<!--
26+
By default, the tests are run against SQLite.
27+
If you want to run them against another DBMS,
28+
see https://www.doctrine-project.org/projects/doctrine-dbal/en/stable/reference/testing.html#running-integration-tests-locally
3329
-->
34-
<!--<var name="db_event_subscribers" value="Doctrine\DBAL\Event\Listeners\OracleSessionInit">-->
35-
36-
<!-- Privileged user connection parameters. Used to create and drop the test database -->
37-
<var name="tmpdb_driver" value="pdo_mysql"/>
38-
<var name="tmpdb_host" value="localhost" />
39-
<var name="tmpdb_port" value="3306"/>
40-
<var name="tmpdb_user" value="root" />
41-
<var name="tmpdb_password" value="" />
42-
<var name="tmpdb_dbname" value="doctrine_tests_tmp" />
4330
</php>
4431

4532
<testsuites>

0 commit comments

Comments
 (0)