From e15a2ffd92473319ff18c9be94b35cba4579a663 Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Fri, 23 May 2014 10:44:03 +0200 Subject: [PATCH] Fix tests --- .../Core/Event/Subscriber/SessionManagerSubscriber.php | 6 ++++++ tests/Alchemy/Tests/Phrasea/Application/LightboxTest.php | 2 +- .../Core/Event/Subscriber/SessionManagerSubscriberTest.php | 6 +++--- tests/classes/PhraseanetPHPUnitListener.php | 1 - 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/SessionManagerSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/SessionManagerSubscriber.php index 6c81980373..16747e7dab 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/SessionManagerSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/SessionManagerSubscriber.php @@ -75,6 +75,7 @@ class SessionManagerSubscriber implements EventSubscriberInterface return; } $moduleName = strtolower($pathInfo[1]); + if (!array_key_exists($moduleName, $modulesIds) ) { return; } @@ -90,6 +91,11 @@ class SessionManagerSubscriber implements EventSubscriberInterface if ($this->isFlashUploadRequest($event->getRequest())) { return; } + + if ($event->getRequest()->query->has('LOG')) { + return; + } + // if we are already disconnected (ex. from another window), quit immediatly if (!($this->app['authentication']->isAuthenticated())) { if ($event->getRequest()->isXmlHttpRequest()) { diff --git a/tests/Alchemy/Tests/Phrasea/Application/LightboxTest.php b/tests/Alchemy/Tests/Phrasea/Application/LightboxTest.php index 9239e34c06..b87282db21 100644 --- a/tests/Alchemy/Tests/Phrasea/Application/LightboxTest.php +++ b/tests/Alchemy/Tests/Phrasea/Application/LightboxTest.php @@ -2,7 +2,7 @@ namespace Alchemy\Tests\Phrasea\Application; -class ApplicationLightboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract +class LightboxTest extends \PhraseanetWebTestCaseAuthenticatedAbstract { protected $client; diff --git a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/SessionManagerSubscriberTest.php b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/SessionManagerSubscriberTest.php index d3615aeacc..e27747f75d 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/SessionManagerSubscriberTest.php +++ b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/SessionManagerSubscriberTest.php @@ -74,9 +74,9 @@ class SessionManagerSubscriberTest extends \PhraseanetWebTestCaseAuthenticatedAb $session->setUpdated(new \DateTime()); $app['EM'] = $this->getMockBuilder('Doctrine\ORM\EntityManager')->disableOriginalConstructor()->getMock(); - $app['EM']->expects($this->once())->method('find')->with($this->equalTo('Entities\Session'))->will($this->returnValue($session)); - $app['EM']->expects($this->exactly(2))->method('persist')->will($this->returnValue(null)); - $app['EM']->expects($this->once())->method('flush')->will($this->returnValue(null)); + $app['EM']->expects($this->exactly(2))->method('find')->with($this->equalTo('Entities\Session'))->will($this->returnValue($session)); + $app['EM']->expects($this->exactly(4))->method('persist')->will($this->returnValue(null)); + $app['EM']->expects($this->exactly(2))->method('flush')->will($this->returnValue(null)); $app['phraseanet.configuration']['session'] = array( 'idle' => 0, diff --git a/tests/classes/PhraseanetPHPUnitListener.php b/tests/classes/PhraseanetPHPUnitListener.php index 1f914bf202..3e8c0cb2d1 100644 --- a/tests/classes/PhraseanetPHPUnitListener.php +++ b/tests/classes/PhraseanetPHPUnitListener.php @@ -40,7 +40,6 @@ class PhraseanetPHPUnitListener implements PHPUnit_Framework_TestListener public function startTest(PHPUnit_Framework_Test $test) { - echo $test->getName() . "\n"; return; }