Skip to content

Commit 539b6fe

Browse files
authored
Merge pull request #476 from XWB/travis
Fixed dependency error, update master from 1.3
2 parents 6726a23 + ccfd6e5 commit 539b6fe

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
=========
33

4+
2.4.1
5+
-----
6+
7+
* Adjust session_listener to work with Symfony 3.4.12 (https://github.com/symfony/symfony/pull/27467).
8+
49
2.4.0
510
-----
611

@@ -189,6 +194,11 @@ access to other services.)
189194
* Added an option `always_vary_on_context_hash` to make it possible to disable
190195
automatically setting the vary headers for the user hash.
191196

197+
1.3.16
198+
------
199+
200+
* Adjust session_listener to work with Symfony 3.4.12 (https://github.com/symfony/symfony/pull/27467).
201+
192202
1.3.15
193203
------
194204

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"symfony/css-selector": "^2.8.18||^3.3||^4.0",
4343
"symfony/expression-language": "^2.8.18||^3.3||^4.0",
4444
"symfony/monolog-bundle": "^2.8.18||^3.3||^4.0",
45+
"symfony/routing": "^2.8.18||^3.3||^4.0",
4546
"matthiasnoback/symfony-dependency-injection-test": "^2.3",
4647
"sebastian/exporter": "^2.0"
4748
},

src/EventListener/SessionListener.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
1515
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
16+
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
1617
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
1718
use Symfony\Component\HttpKernel\EventListener\SessionListener as BaseSessionListener;
1819

@@ -81,6 +82,12 @@ public function onKernelResponse(FilterResponseEvent $event)
8182
// noop, see class description
8283
}
8384

85+
public function onFinishRequest(FinishRequestEvent $event)
86+
{
87+
// this hook has been added in symfony 3.4.12 - older versions of the listener do not register for it
88+
$this->inner->onFinishRequest($event);
89+
}
90+
8491
public static function getSubscribedEvents(): array
8592
{
8693
return BaseSessionListener::getSubscribedEvents();

tests/Unit/EventListener/SessionListenerTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,32 @@ public function testOnKernelRequestRemainsUntouched()
3838
$listener->onKernelRequest($event);
3939
}
4040

41+
public function testOnFinishRequestRemainsUntouched()
42+
{
43+
if (!method_exists('Symfony\Component\HttpKernel\EventListener\SessionListener', 'onFinishRequest')) {
44+
$this->markTestSkipped('Method onFinishRequest does not exist on Symfony\Component\HttpKernel\EventListener\SessionListener');
45+
}
46+
47+
$event = $this
48+
->getMockBuilder('Symfony\Component\HttpKernel\Event\FinishRequestEvent')
49+
->disableOriginalConstructor()
50+
->getMock();
51+
52+
$inner = $this
53+
->getMockBuilder('Symfony\Component\HttpKernel\EventListener\SessionListener')
54+
->disableOriginalConstructor()
55+
->getMock();
56+
57+
$inner
58+
->expects($this->once())
59+
->method('onFinishRequest')
60+
->with($event)
61+
;
62+
63+
$listener = $this->getListener($inner);
64+
$listener->onFinishRequest($event);
65+
}
66+
4167
/**
4268
* @dataProvider onKernelResponseProvider
4369
*/

0 commit comments

Comments
 (0)