Commit Graph

24 Commits

Author SHA1 Message Date
Damian Mooyman
1e612607aa Suggested improvements / test case fixes 2014-10-10 09:28:11 +13:00
Daniel Hensby
3b9056fc01 NEW Cookie_Backend for managing cookie state
I've decoupled `Cookie` from the actual act of setting and getting
cookies. Currently there are a few limitations to how Cookie works that
this change mitigates:

0. `Cookie` currently changes the super global `$_COOKIE` when setting
to make the state of an application a bit more managable, but this is
bad because we shouldn't be modifying super globals
0. One can't actually change the `$cookie_class` once the
`Cookie::$inst` has been instantiated
0. One can't test cookies as there is no class that holds the state of
the cookies (it's just held in the super global which is reset as part
of `Director::test()`
0. One can't tell the origin of a cookie (eg: did the application set it
and it needs to be sent, or did we receive it from the browser?)
0. `time()` was used, so testing was made difficult
0. There was no way to get all the cookies at once (without accessing
the super global)

Todos are on the phpdoc and I'd like to write some tests for the backend
as well as update the docs (if there are any) around cookies.
DOCS Adding `Cookie` docs

Explains basic usage of `Cookie` as well as how the `Cookie_Backend`
controls the setting and getting of cookies and manages state of sent vs
received cookies
Fixing `Cookie` usage

`Cookie` is being used inconsistently with the API throughout framework.
Either by not using `force_expiry` to expire cookies or setting them to
null and then expiring them (which is redundant).
NEW `Director::test()` takes `Cookie_Backend` rather than `array` for `$cookies` param
2014-10-06 17:44:51 +13:00
Damian Mooyman
08c58844ac PHPDoc cleanup 2014-07-29 12:43:43 +12:00
Sean Harvey
0ee3a683a5 Better support for overloading start and destroy methods in Session
Move functionality from static start and destroy functions into instance
methods, allowing these to be overloaded. This works the same way as
calling Session::set() which then in turn calls inst_set()

Additionally use Injector to create the default Session instance to
allow the class to be swapped out.
2014-06-20 10:35:53 +12:00
Sam Minnee
b43bf68f9c MINOR: Minor fixes to FunctionalTest 2013-01-29 18:03:48 +01:00
Sam Minnee
1f7fc1f76a FIX Remove instances of lines longer than 120c
The entire framework repo (with the exception of system-generated files) has been amended to respect the 120c line-length limit.  This is in preparation for the enforcement of this rule with PHP_CodeSniffer.
2012-09-30 17:18:13 +13:00
Ingo Schommer
e2f073f38a Method visibility according to coding conventions 2012-09-20 10:46:59 +02:00
Sean Harvey
b325fea709 MINOR Fixing "No current controller available" error when TestSession::__destruct() is called 2012-05-24 16:41:29 +12:00
Ingo Schommer
1f7f8b8aee BUGFIX Don't' set 'Referer' header in FunctionalTest->get()/post() if its explicitly passed to the method 2012-05-04 11:49:30 +02:00
Simon Welsh
f07258f3cf MINOR Update @package values to match renaming sapphire 2012-04-15 10:50:19 +12:00
Simon Welsh
f8082e4814 MINOR Add newline to end of files without one 2012-04-15 10:50:19 +12:00
Ingo Schommer
41dad508e4 MINOR Documentation in FunctionalTest and TestSession
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@114140 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-11-24 06:23:52 +00:00
Ingo Schommer
86cae58d4c BUGFIX: TestSession::submitForm throws proper error if form not found (from r104972)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112413 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-15 01:18:22 +00:00
Sam Minnee
2948bc1c64 MINOR: Misc merges from branches/2.4
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112142 467b73ca-7a2a-4603-9d3b-597d59a354a9
2010-10-13 03:53:12 +00:00
Sean Harvey
e64443b50d MINOR: added cookies to Director::test() (from r94684)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@95620 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-12-16 05:42:43 +00:00
Andrew Short
79773042be API CHANGE: Renamed conflicting classes to have an "SS_" namespace, and renamed existing "SS" namespace to "SS_". The affected classes are: HTTPRequest, HTTPResponse, Query, Database, SSBacktrace, SSCli, SSDatetime, SSDatetimeTest, SSLog, SSLogTest, SSLogEmailWriter, SSLogErrorEmailFormatter, SSLogErrorFileFormatter, SSLogFileWriter and SSZendLog.
MINOR: Replaced usage of renamed classes with the new namespaced name.

From: Andrew Short <andrewjshort@gmail.com>

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@90075 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-26 03:06:31 +00:00
Ingo Schommer
5018dc0ada MINOR Fixed assignment by reference in TestSession->lastPage() (deprecated in PHP 5.3)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@89244 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-10-16 01:21:53 +00:00
Sam Minnee
3951b0ac84 BUGFIX: If a FunctionalTest fails in the middle of a get() or post() call, return an error other than the controller stack failing.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@78413 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-06-04 06:46:30 +00:00
Ingo Schommer
d26f08b481 MINOR merged branches/2.3 into trunk
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@67465 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-12-04 22:38:32 +00:00
Ingo Schommer
be0d3e37c5 ENHANCEMENT Added Controller->redirectBack()
BUGFIX Storing HTTP "Referer" header from $_SERVER in Director::direct() and passing it along in Director::test()
ENHANCEMENT Storing a "fake referer" in TestSession->lastURL to allow for redirectBack() calls, e.g. after failed form validation

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64229 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-10-14 19:59:01 +00:00
Sam Minnee
a94c7c8a2f Improved error checking in TestSession
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60425 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-08-11 23:02:22 +00:00
Ingo Schommer
6b1a6d9856 MINOR Fixed simpletest require_once()
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@56229 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-06-15 14:20:44 +00:00
Ingo Schommer
60860cc1b9 MINOR Unified @package PHPdoc (added where missing, removed duplicates)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@56212 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-06-15 13:33:53 +00:00
Mark Rickerby
f606f92be6 renaming 'testing' to 'dev' after discussion with Sam
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@55798 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-06-06 03:13:21 +00:00