10000 [FrameworkBundle] Fixed logic under test environment. · Pull Request #6369 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle] Fixed logic under test environment. #6369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from Dec 15, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,10 @@ public function onKernelResponse(FilterResponseEvent $event)
return;
}

if ($session = $event->getRequest()->getSession()) {
if ($session->isStarted()) {
$session->save();
}

$session = $event->getRequest()->getSession();
if ($session && $session->isStarted()) {
$session->save();
$params = session_get_cookie_params();

$event->getResponse()->headers->setCookie(new Cookie($session->getName(), $session->getId(), 0 === $params['lifetime'] ? 0 : time() + $params['lifetime'], $params['path'], $params['domain'], $params['secure'], $params['httponly']));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpFoundation\Session\SessionInterface;

/**
* SessionListenerTest.
Expand All @@ -26,7 +27,14 @@
*/
class TestSessionListenerTest extends \PHPUnit_Framework_TestCase
{
/**
* @var TestSessionListener
*/
private $listener;

/**
* @var SessionInterface
*/
private $session;

protected function setUp()
Expand Down Expand Up @@ -58,6 +66,8 @@ public function testShouldNotSaveSubRequestSession()

public function testDoesNotDeleteCookieIfUsingSessionLifetime()
{
$this->sessionHasBeenStarted();

$params = session_get_cookie_params();
session_set_cookie_params(0, $params['path'], $params['domain'], $params['secure'], $params['httponly']);

Expand Down
0