Commit Graph

8 Commits

Author SHA1 Message Date
Indy Griffiths
730374d666 Remove reference to Object with SS_Object 2019-10-15 09:12:37 +13:00
Matt
bdc3d6a835 Add Resque_Event::listen() call to register the testsession state switcher
with the silverstripe-resque module.
2014-02-12 13:47:40 +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
Ingo Schommer
72b48f4c38 API State setting within session, make tmpdb optional
- Allow limited state setting when session is already in progress
- Allow test sessions without a test database
- Denote an “in progress” session through a “testsession.started” session flag rather than the usage of a temporary database
2013-12-10 19:34:37 +01:00
Ingo Schommer
77e29d47c7 Using 3.1 compatible Config API for setup
Avoids deprecation notices when testing against master
2013-06-19 12:12:11 +02:00
Ingo Schommer
9a8d24c116 Check for Security.token before setting test session state
Otherwise we'll get into a catch22 if it's not set:
The manifest includes this _config.php, which in turn
throws a fatal exception on the token not existing.
It would be recreated a couple of lines further down in Core.php
when the ConfigManifest is pushed, but never gets this far.
2013-06-04 15:00:54 +02:00
Ingo Schommer
7e8021af04 NEW Mailer class and mock date support 2012-12-19 15:47:39 +01:00
Ingo Schommer
db290a1cf9 Initial commit
Mostly migrated from 3.0 core, with some documentation adjustments.
Removed the unused dev/tests/sessionloadyaml command.
2012-12-19 14:20:06 +01:00