mirror of
https://github.com/silverstripe/silverstripe-testsession
synced 2024-10-22 14:06:00 +02:00
Fix session accessors
This commit is contained in:
parent
1ab843776d
commit
9ec863f917
@ -86,10 +86,10 @@ class TestSessionEnvironment
|
|||||||
public function init(HTTPRequest $request)
|
public function init(HTTPRequest $request)
|
||||||
{
|
{
|
||||||
if (!$this->id) {
|
if (!$this->id) {
|
||||||
$request->getSession()->start();
|
$request->getSession()->init();
|
||||||
// $_SESSION != Session::get() in some execution paths, suspect Controller->pushCurrent()
|
// $_SESSION != Session::get() in some execution paths, suspect Controller->pushCurrent()
|
||||||
// as part of the issue, easiest resolution is to use session directly for now
|
// as part of the issue, easiest resolution is to use session directly for now
|
||||||
$this->id = (isset($_SESSION['TestSessionId'])) ? $_SESSION['TestSessionId'] : null;
|
$this->id = $request->getSession()->get('TestSessionId');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ use SilverStripe\Control\Email\Mailer;
|
|||||||
use SilverStripe\Control\HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Control\HTTPResponse;
|
use SilverStripe\Control\HTTPResponse;
|
||||||
use SilverStripe\Control\RequestFilter;
|
use SilverStripe\Control\RequestFilter;
|
||||||
use SilverStripe\Control\Session;
|
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\ORM\FieldType\DBDatetime;
|
use SilverStripe\ORM\FieldType\DBDatetime;
|
||||||
@ -76,7 +75,7 @@ class TestSessionRequestFilter implements RequestFilter
|
|||||||
|
|
||||||
// Store PHP session
|
// Store PHP session
|
||||||
$state = $this->testSessionEnvironment->getState();
|
$state = $this->testSessionEnvironment->getState();
|
||||||
$state->session = Session::get_all();
|
$state->session = $request->getSession()->getAll();
|
||||||
$this->testSessionEnvironment->applyState($state);
|
$this->testSessionEnvironment->applyState($state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user