Nimut / testing-framework

TYPO3 testing framework that provides base classes and configuration for PHPUnit tests
GNU General Public License v2.0
52 stars 25 forks source link

Support sqlite #131

Closed simonschaufi closed 4 years ago

simonschaufi commented 4 years ago

Since TYPO3 officially supports sqlite databases, this extension should as well.

See https://github.com/TYPO3/testing-framework/pull/79 which implemented this in TYPO3 testing-framework and maybe also https://github.com/TYPO3/testing-framework/pull/121

typo3DatabaseDriver=pdo_sqlite .Build/bin/phpunit -c .Build/vendor/nimut/testing-framework/res/Configuration/FunctionalTests.xml Tests/Functional/

This command fails because of setDBinit configuration. It actually crashes in the initializeTestDatabase method.

When I set the value to an empty string, I still get an error if 2 following tests are executed with the second iteration in the method setUpTestDatabase and the $schemaManager->listDatabases() call. This is not supported in sqlite:

Doctrine\DBAL\DBALException: Operation 'Doctrine\DBAL\Platforms\AbstractPlatform::getListDatabasesSQL' is not supported by platform.
IchHabRecht commented 4 years ago

Hi @simonschaufi,

are your tests running with the typo3/testing-framework?

simonschaufi commented 4 years ago

I haven't tried it but I just wanted to ask you anyway why there are 2 frameworks for the same purpose. Should I switch to typo3/testing-framework or what is the advantage of THIS framework?

IchHabRecht commented 4 years ago

This testing-framework is able to be used for supporting multiple TYPO3 versions as extensions normally do/want. As far as I know the setUpTestDatabase code should be the same for both testing frameworks. That's why I asked if you ever tried to run your tests on sqlite with the typo3/testing-framework.

simonschaufi commented 4 years ago

Yes, when I exchange the testing framework then the tests run fine with sqlite.

IchHabRecht commented 4 years ago

Hi @simonschaufi,

Would you mind to test the pull request #132 to see if this fixes your tests?

simonschaufi commented 4 years ago

Sure, what about this PR https://github.com/TYPO3/testing-framework/pull/121?

IchHabRecht commented 4 years ago

I'm currently not able to spend more time in this support. If this is important for you, please stay with the typo3/testing-framework. I just tried to fix your recommendation to be able to run tests with SQLite

simonschaufi commented 4 years ago

In method getDatabaseConfiguration the line should look like this:

if ($databaseName || $databaseHost || $databaseUsername || $databasePassword || $databasePort || $databaseSocket || $databaseDriver) {

then it works. Thank you for the quick pr!

simonschaufi commented 4 years ago

@IchHabRecht Thank you very much! :orange_heart:

IchHabRecht commented 4 years ago

Hi @simonschaufi,

I just released a new version 5.0.4 with the fix. Thank you for your help and patience.