Skip to content

Commit 7fb00fd

Browse files
committed
Merge branch '3.8.x' into 4.0.x
* 3.8.x: Avoid calling deprecated Type::getName() (#6359) Ensure correct json default value normalization (#6358) Document how to run integration tests locally Remove unused script
2 parents c70bae9 + edbf307 commit 7fb00fd

File tree

5 files changed

+44
-30
lines changed

5 files changed

+44
-30
lines changed

ci/travis/install-mariadb.sh

-13
This file was deleted.

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
88+
:doc:`officially supported versions <reference/platforms>`.
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>

src/Schema/PostgreSQLSchemaManager.php

+1
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ protected function _getPortableTableColumnDefinition(array $tableColumn): Column
298298
$length = null;
299299
break;
300300

301+
case 'json':
301302
case 'text':
302303
case '_varchar':
303304
case 'varchar':

tests/Functional/Schema/PostgreSQLSchemaManagerTest.php

+14
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,20 @@ public function testDefaultValueCharacterVarying(): void
259259
self::assertEquals('foo', $databaseTable->getColumn('def')->getDefault());
260260
}
261261

262+
public function testJsonDefaultValue(): void
263+
{
264+
$testTable = new Table('test_json');
265+
$testTable
266+
->addColumn('foo', Types::JSON)
267+
->setDefault('{"key": "value with a single quote \' in string value"}');
268+
$this->dropAndCreateTable($testTable);
269+
270+
$columns = $this->schemaManager->listTableColumns('test_json');
271+
272+
self::assertSame(Type::getType(Types::JSON), $columns['foo']->getType());
273+
self::assertSame('{"key": "value with a single quote \' in string value"}', $columns['foo']->getDefault());
274+
}
275+
262276
public function testBooleanDefault(): void
263277
{
264278
$table = new Table('ddc2843_bools');

0 commit comments

Comments
 (0)