This repository has been archived by the owner on Nov 26, 2017. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One of of my frustrations with the test suite for a while has been the necessity to spend time setting up an environment to run the simplest of tests. Now that we have an SQLite database driver I thought it would be great to have the base test suite not require any setup or configuration to run. You simply clone the repository and call
phpunit
to have the suite run.To achieve this a few things had to be done:
tests/ddl.sql
schema file for SQLite was createdtests/includes/JoomlaDatabaseTestCase.php
was modified to utilize an SQLite memory database.JTEST_HTTP_STUB
or as an operating system environment variableJTEST_HTTP_STUB
, otherwise those tests will be skipped.tests/config.dist.php
was removed since a tests configuration isn't necessary to run the default tests.Testing database drivers.
With these changes database drivers have been broken out into their own path:
tests/suites/database
where tests can be written independent of the main suite. If you look in the phpunit.xml.dist file you will find a section commented out with PHP constant definitions in it. To enable testing of specific drivers you simply add the relevant constant with a DSN string for the database instance you want the tests to run against. The commented out examples are the same default configuration that has been present.Nice side effects.
One of the nice side effects of this exercise (and going forward) is the use of a non-MySQL engine for discovering cross-database problems. Several bugs and limitations were uncovered during the process and continuing down this path will only help in this area.