joomla/joomla-platform — pull request #967 by LouisLandry (2012-03-07 07:03:48+00:00)
Title: Change unit test suite to use an SQLite memory database.

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 created
* `tests/includes/JoomlaDatabaseTestCase.php` was modified to utilize an SQLite memory database.
* To execute the URL to the JHttp test stub file must be set either as a PHP constant `JTEST_HTTP_STUB` or as an operating system environment variable `JTEST_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.

### Things left to work through.

We still need to work out a better way of handling the (optional) testing of our database drivers against external systems. The way it is done now is sub-optimal to put it nicely. That fix is out of scope for this pull request, but something I hope we can address in the near future.

### 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.