Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.

First functional test database connection fails with Doctrine DBAL 2.13 #136

Closed
mbrodala opened this issue May 11, 2021 · 5 comments
Closed

Comments

@mbrodala
Copy link
Contributor

I just did an update to TYPO3 10.4.16 which, among others, brings compatibility with Doctrine DBAL 2.13. Thus the latter was also updated to the latest 2.13 version.

Now the first of each functional tests fails to connect to the database. The database exists after the test so maybe something has changed in Doctrine which causes an earlier connection before the FunctionalTestCase setup.

First functional test run with Doctrine 2.13.1 ✖
$ composer show doctrine/dbal | grep versions
versions : * 2.13.1
$ mysql -h... -u... -p... -e "DROP DATABASE IF EXISTS typo3_functional_ft3d326a3;"
$ rm -rf .../typo3temp/var/tests/functional-3d326a3/
$ phpunit --configuration phpunit-functional.xml --colors=always --filter SampleFunctionalTest

PHPUnit Pretty Result Printer 0.29.3 by Codedungeon and contributors.
==> Configuration: /.../vendor/codedungeon/phpunit-result-printer/src/phpunit-printer.yml

PHPUnit 7.5.20 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.16
Configuration: /.../phpunit-functional.xml


 ==> SampleFunctionalTest     ⚈  

Time: 4.11 seconds, Memory: 12.00 MB

✖ There was 1 error:

1) Acme\Package\Tests\Functional\SampleFunctionalTest::test
  PHPUnit\Framework\Exception: PHP Warning:  mysqli::real_connect(): (HY000/1049): Unknown database 'typo3_functional_ft3d326a3' in /.../vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php on line 86

ERRORS!
Tests: 1, Assertions: 0, Errors: 1.
Subsequent functional test run with Doctrine 2.13.1 ✔
$ phpunit --configuration phpunit-functional.xml --colors=always --filter SampleFunctionalTest

PHPUnit Pretty Result Printer 0.29.3 by Codedungeon and contributors.
==> Configuration: /.../vendor/codedungeon/phpunit-result-printer/src/phpunit-printer.yml

PHPUnit 7.5.20 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.16
Configuration: /.../phpunit-functional.xml


 ==> SampleFunctionalTest     ✔  

Time: 2.28 seconds, Memory: 12.00 MB

OK (1 test, 6 assertions)

Downgrading to Doctrine 2.11.x fixes the problem:

First functional test run with Doctrine 2.11.3 ✔
$ composer show doctrine/dbal | grep versions
versions : * 2.11.3
$ mysql -h... -u... -p... -e "DROP DATABASE IF EXISTS typo3_functional_ft3d326a3;"
$ rm -rf .../typo3temp/var/tests/functional-3d326a3/
$ phpunit --configuration phpunit-functional.xml --colors=always --filter SampleFunctionalTest

PHPUnit Pretty Result Printer 0.29.3 by Codedungeon and contributors.
==> Configuration: /.../vendor/codedungeon/phpunit-result-printer/src/phpunit-printer.yml

PHPUnit 7.5.20 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.4.16
Configuration: /.../phpunit-functional.xml


 ==> SampleFunctionalTest     ✔  

Time: 2.28 seconds, Memory: 12.00 MB

OK (1 test, 6 assertions)
@mbrodala
Copy link
Contributor Author

Public example: https://github.com/pagemachine/typo3-flat-urls/pull/40/checks?check_run_id=2556292024

image

Notice how the first of all tests for a SUT fails.

@AnatoliZich
Copy link

I can confirm this, even though im using the typo3/testing-framework. Downgrading doctrine/dbal to 2.11.3 fixes the problem.

@tomasnorre
Copy link
Contributor

I can confirm this + the downgrade to 2.11.x

dkd-kaehm added a commit to dkd-kaehm/solr-ddev-site that referenced this issue May 14, 2021
* Downgrades doctrine/dbal to v2.11.3, to be able to run tests locally
   See: Nimut/testing-framework#136
   After clarifications of that issue the explicit version constraint 
   of doctrine/dbal should be removed.
* Upgrades bk2k/bootstrap-package to v11.0.3
dkd-kaehm added a commit to TYPO3-Solr/solr-ddev-site that referenced this issue May 14, 2021
* Downgrades doctrine/dbal to v2.11.3, to be able to run tests locally
   See: Nimut/testing-framework#136
   After clarifications of that issue the explicit version constraint 
   of doctrine/dbal should be removed.
* Upgrades bk2k/bootstrap-package to v11.0.3
dkd-kaehm added a commit to TYPO3-Solr/solr-ddev-site that referenced this issue May 20, 2021
* Downgrades doctrine/dbal to v2.11.3, to be able to run tests locally
   See: Nimut/testing-framework#136
   After clarifications of that issue the explicit version constraint 
   of doctrine/dbal should be removed.
* Upgrades bk2k/bootstrap-package to v11.0.3
@IchHabRecht
Copy link
Contributor

After some investigations, the problem occures due to changes in the doctrine/dbal project. It is already fixed in the latest development branch (doctrine/dbal@b9b30b2#diff-e109793061ef1816d2ddf43ca20f451a9f79adf03e4c15ddf9efd82b8fd81dc8) and should be fixed with the next doctrine/dbal release. The testing-framework needs to mark doctrine versions 2.13.0 and 2.13.1 as conflict.

@mbrodala
Copy link
Contributor Author

Yes, thanks for the interim fix!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants