fixed previous merge

This commit is contained in:
Fabien Potencier 2012-07-01 23:21:53 +02:00
parent d2b5208a77
commit 6dd342c351
7 changed files with 13 additions and 15 deletions

View File

@ -526,7 +526,7 @@ class Request
*/ */
public function hasSession() public function hasSession()
{ {
return null !== $this->session && $this->session->isStarted(); return null !== $this->session;
} }
/** /**

View File

@ -177,13 +177,11 @@ interface SessionInterface
function clear(); function clear();
/** /**
* Check if a session was started * Checks if the session was started.
* *
* @api * @return Boolean
*
* @return boolean
*/ */
public function isStarted(); function isStarted();
/** /**
* Registers a SessionBagInterface with the session. * Registers a SessionBagInterface with the session.

View File

@ -205,9 +205,7 @@ class MockArraySessionStorage implements SessionStorageInterface
} }
/** /**
* Check if the session was started or not * {@inheritdoc}
*
* @return boolean
*/ */
public function isStarted() public function isStarted()
{ {

View File

@ -290,9 +290,7 @@ class NativeSessionStorage implements SessionStorageInterface
} }
/** /**
* Check if the session was started or not * {@inheritdoc}
*
* @return boolean
*/ */
public function isStarted() public function isStarted()
{ {

View File

@ -35,6 +35,13 @@ interface SessionStorageInterface
*/ */
function start(); function start();
/**
* Checks if the session is started.
*
* @return boolean True if started, false otherwise.
*/
function isStarted();
/** /**
* Returns the session ID * Returns the session ID
* *

View File

@ -949,7 +949,6 @@ class RequestTest extends \PHPUnit_Framework_TestCase
$this->assertFalse($request->hasSession()); $this->assertFalse($request->hasSession());
$request->setSession(new Session(new MockArraySessionStorage())); $request->setSession(new Session(new MockArraySessionStorage()));
$request->getSession()->start();
$this->assertTrue($request->hasSession()); $this->assertTrue($request->hasSession());
} }
@ -961,7 +960,6 @@ class RequestTest extends \PHPUnit_Framework_TestCase
$request->cookies->set('MOCKSESSID', 'foo'); $request->cookies->set('MOCKSESSID', 'foo');
$this->assertFalse($request->hasPreviousSession()); $this->assertFalse($request->hasPreviousSession());
$request->setSession(new Session(new MockArraySessionStorage())); $request->setSession(new Session(new MockArraySessionStorage()));
$request->getSession()->start();
$this->assertTrue($request->hasPreviousSession()); $this->assertTrue($request->hasPreviousSession());
} }

View File

@ -85,7 +85,6 @@ class ContextListenerTest extends \PHPUnit_Framework_TestCase
protected function runSessionOnKernelResponse($newToken, $original = null) protected function runSessionOnKernelResponse($newToken, $original = null)
{ {
$session = new Session(new MockArraySessionStorage()); $session = new Session(new MockArraySessionStorage());
$session->start();
if ($original !== null) { if ($original !== null) {
$session->set('_security_session', $original); $session->set('_security_session', $original);