Commit Graph

7 Commits

Author SHA1 Message Date
Ingo Schommer c247392da0 API Replace TestSessionDatabaseState with JSON persistence, store PHP session 2014-03-01 14:32:22 +13:00
Ingo Schommer 2f85acdd18 Removed inst(), its duplicating Injector functionality 2014-03-01 11:06:48 +13:00
Ingo Schommer 2c12cde90a Make 'database' state optional 2014-02-27 14:47:22 +13:00
Ingo Schommer add47cb625 Allow requireDefaultRecords population 2014-02-26 16:41:21 +13:00
madmatt 962e8214f2 FIX: Properly extend onBeforeStartTestSession so extensions can modify the $state array 2014-02-26 16:41:16 +13:00
Ingo Schommer 9b72ee0554 Doc tweaks around new test file 2014-02-09 18:48:25 +13:00
madmatt 42be37db53 Refactor testsession module to use file-based session state storage.
This is a major refactoring of the testsession module to use a persistent file
storage instead of using $_SESSION storage. The primary reason for this is for
out-of-band tests (e.g. simplifying Behat tests, and testing modules like
silverstripe-resque (https://github.com/stojg/silverstripe-resque)). Testing
the silverstripe-resque module without this is impossible as the PHP code
running the job has been started and loaded into memory long before you started
a testsession.

By default, this will create a TESTS_RUNNING.json file in your webroot, which
means that tests need to be run as a user who has permission to create files
there. In practice, this means your webroot needs to be owned by your webserver
user. The reason we store the file here is that it will show up as a changed
file in version control, so it’s more prominent if developers can’t figure out
why there are issues with database content.

API CHANGES:
- Add persistent file storage (using webroot/TESTS_RUNNING.json) as a base.
- Update TestSessionController to use new TestSessionEnvironment class.
- Moved extension points from TestSessionController to TestSessionEnvironment.
- Moved loadFixtureIntoDb from TestSessionController to TestSessionEnvironment.
- Moved setState from TestSessionController to TestSessionEnvironment.
  - Deprecated the use of TestSessionController::setState()

FIXES:
- Fixes TestSessionRequestFilter to use new TestSessionEnvironment instead of
  $_SESSION.

MINOR:
- Renamed TestSesssionRequestFilter.php to fix spelling error (three ’S’s)
  - Class did not need renaming, just the file itself.
2014-02-09 18:48:25 +13:00