Commit Graph

133 Commits

Author SHA1 Message Date
Ben Manu
a50bab5445 Add umask when saving state to the file system to prevent permission denied error 2014-11-06 08:43:38 +13:00
Jeffrey Guo
50bf3580c8 added comments for global test session 2014-09-03 17:23:57 +12:00
Ingo Schommer
cedb6e26ce Add --dev to install instructions
We shouldn't encourage users to install this in a way that'll make it to a production system
2014-09-03 11:20:07 +12:00
Damian Mooyman
69d20eade1 Merge pull request #15 from tractorcow/pulls/3.2-api
Update for framework 3.2 compatibility
2014-07-21 10:38:49 +12:00
Damian Mooyman
63e7051f3e Update .travis.yml for 3.2 2014-07-21 10:36:25 +12:00
Damian Mooyman
869b4e8933 Update for framework 3.2 compatibility 2014-07-21 10:32:39 +12:00
Damian Mooyman
b98bbbe276 Merge pull request #14 from tractorcow/pulls/3.1-api
Fix branch to 3.1 compatibility
2014-07-21 10:29:34 +12:00
Damian Mooyman
3d774f7867 Fix branch to 3.1 compatibility 2014-07-21 10:19:33 +12:00
Damian Mooyman
d91aae5945 Merge pull request #13 from madmatt/pulls/travis-support
MINOR: Add https://travis-ci.org/ support to testsession
2014-06-19 11:01:07 +12:00
madmatt
dcdbadc716 MINOR: Add https://travis-ci.org/ support to testsession 2014-06-18 13:20:24 +12:00
Damian Mooyman
a4d07150ca Merge pull request #12 from halkyon/hardcoded_queries
Fixing hardcoded queries that are MySQL specific.
2014-06-12 15:53:53 +12:00
Sean Harvey
020fcbea26 Fixing hardcoded queries that are MySQL specific. 2014-06-12 14:44:55 +12:00
Ingo Schommer
3f60aac770 Using $_SESSION directly, Session::get() is broken 2014-05-15 17:29:29 +12:00
Ingo Schommer
4b15214588 Modify state by reference to allow removals through 'onBeforeStartTestSession' 2014-05-08 14:13:49 +12:00
Ingo Schommer
0a1a318623 Fixed sql splitting
Was breaking on ' '
2014-05-08 13:15:06 +12:00
Ingo Schommer
bb9994ddca Allow "global" test sessions 2014-05-06 16:45:55 +12:00
Ingo Schommer
1582e74d10 API Explicit DB import, partially revert DB connection changes
- Renamed 'createDatabaseTemplate' to 'importDatabasePath'
- No longer using 'createDatabase' flag, always loading a new DB
- Reinstating SELECT DATABASE and SHOW DATABASES checks to ensure DBs don't get created multiple times
2014-05-05 22:59:26 +12:00
Sean Harvey
2a13ce2d08 Merge pull request #11 from mateusz/add-guard
BUG Add a guard to prevent Behat runs from failing.
2014-04-01 16:38:12 +13:00
Mateusz Uzdowski
4d77dc6565 BUG Add a guard to prevent Behat runs from failing. 2014-04-01 15:48:12 +13:00
Ingo Schommer
975e6bed56 Revert "Clean up applyState"
This reverts commit 5c5438abee.

Breaks core builds.
2014-03-17 22:59:17 +13:00
Ingo Schommer
fe980540b9 Revert TEMP_FOLDER change from ccc8dd061c
It obscures the fact that you're in a test session
by hiding it away in system folders. Having it in assets/
is confusing enough if your webroot isn't writeable.

/cc @wilr
2014-03-17 22:11:25 +13:00
Ingo Schommer
72e8234457 Fixed regression from 5c5438abee 2014-03-17 21:42:47 +13:00
Will Rossiter
5c5438abee Clean up applyState 2014-03-16 17:16:34 +13:00
Will Rossiter
ccc8dd061c If default path is not writable, fallback to tmp dir. 2014-03-16 17:14:43 +13:00
Ingo Schommer
8aaaacc23c Fixed regression on file paths in manual test sessions 2014-03-04 17:49:41 +13:00
Ingo Schommer
2b5984a73c Coupling environment with PHP session info, avoids injector troubles
I'd rather have Session::get('TestSessionId') being passed in
as an identifier, but the env object is passed around so much
as a singleton that its easy to forget that argument,
and cause hard to debug errors. We need a global "app" object
which all other objects can reference somehow.
2014-03-03 16:40:03 +13:00
Ingo Schommer
808d6aa87a Tie test session files to browser session 2014-03-02 11:44:58 +13:00
Ingo Schommer
40dd841eb3 API Persist state directly on disk
In memory state can get out of date between CLI and web requests,
leading to hard to debug errors. The performance impact of this
should be low, given the size of the JSON file.
2014-03-01 20:16:20 +13:00
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
8eaeeb39d1 Removed reflexive behat dependency, not actually needed 2014-03-01 10:33:40 +13:00
Ingo Schommer
adc3ac5c38 Merge pull request #10 from silverstripe-labs/pulls/php-session-state
Allow setting PHP session state
2014-02-27 15:10:25 +13:00
Ingo Schommer
6b13c782c3 Clarified warning 2014-02-27 15:10:18 +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
54a8e673a6 Allow setting PHP session state 2014-02-26 13:34:38 +13:00
Ingo Schommer
e198f738b4 Merge pull request #9 from madmatt/pulls/resque-event
Add Resque_Event::listen() call to register the testsession state switcher with the silverstripe-resque module.
2014-02-16 09:57:09 +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
Ingo Schommer
9b72ee0554 Doc tweaks around new test file 2014-02-09 18:48:25 +13:00
Ingo Schommer
3a4cb71808 Using instance reference for TestSessionEnv 2014-02-09 18:48:25 +13:00
Ingo Schommer
cd5ac2c752 Removed security token docs, no longer needed 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
Ingo Schommer
1f67061901 Merge pull request #8 from mateusz/php53
Fix syntax to work with php 5.3, in line with required dependency.
2014-02-07 11:41:13 +13:00
Mateusz Uzdowski
bb289936cf Fix syntax to work with php 5.3, in line with required dependency. 2014-02-07 11:39:36 +13:00
Ingo Schommer
20efb0c6fa Allow extension of init() 2013-12-18 16:07:37 +01:00
Ingo Schommer
bfb6ee04c8 Added onRegister hook 2013-12-16 23:48:24 +01:00
Ingo Schommer
356446d4cb Load test data from database dumps 2013-12-12 14:18:18 +01:00
Ingo Schommer
89a429c6a5 Don't require authentication for "test" environments
We use testsession to build up test state e.g. for checking
logins, so having an admin logged-in to operate the testsession
controller is counterproductive.
2013-12-12 01:08:29 +01:00
Ingo Schommer
de47ef0ed1 Remvoed auto-create of database, it overrides the form choice 2013-12-11 00:43:00 +01:00