Skip to content

Commit

Permalink
Fixed stateful response
Browse files Browse the repository at this point in the history
Fixed tests related to previous commit
  • Loading branch information
Xavier Coureau committed Feb 9, 2015
1 parent b2985e6 commit 24ce860
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Listener/WordpressRequestListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public function onKernelRequest(GetResponseEvent $event)
*/
protected function checkAuthentication(Request $request)
{
if (!$request->hasPreviousSession()) {
return;
}

$session = $request->getSession();

if ($session->has('token')) {
Expand Down
1 change: 1 addition & 0 deletions Tests/Listener/WordpressRequestListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function testOnKernelRequestUserLogged()

// Set up a request mock to give to GetResponseEvent class below
$request = $this->getMock('\Symfony\Component\HttpFoundation\Request');
$request->expects($this->once())->method('hasPreviousSession')->will($this->returnValue(true));
$request->expects($this->any())->method('getSession')->will($this->returnValue($this->getSession()));

$getResponseEvent = new GetResponseEvent(
Expand Down

0 comments on commit 24ce860

Please sign in to comment.