Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
e9571ccc
Commit
e9571ccc
authored
Mar 19, 2014
by
Romain Neutron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #856: Revert
a0644877
as it introduced a BC break
parent
5f449095
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
23 deletions
+4
-23
src/Silex/EventListener/ConverterListener.php
src/Silex/EventListener/ConverterListener.php
+4
-4
tests/Silex/Tests/ApplicationTest.php
tests/Silex/Tests/ApplicationTest.php
+0
-19
No files found.
src/Silex/EventListener/ConverterListener.php
View file @
e9571ccc
...
...
@@ -13,7 +13,7 @@ namespace Silex\EventListener;
use
Silex\CallbackResolver
;
use
Symfony\Component\HttpKernel\KernelEvents
;
use
Symfony\Component\HttpKernel\Event\
GetResponse
Event
;
use
Symfony\Component\HttpKernel\Event\
FilterController
Event
;
use
Symfony\Component\EventDispatcher\EventSubscriberInterface
;
use
Symfony\Component\Routing\RouteCollection
;
...
...
@@ -42,9 +42,9 @@ class ConverterListener implements EventSubscriberInterface
/**
* Handles converters.
*
* @param
GetResponse
Event $event The event to handle
* @param
FilterController
Event $event The event to handle
*/
public
function
onKernel
Request
(
GetResponse
Event
$event
)
public
function
onKernel
Controller
(
FilterController
Event
$event
)
{
$request
=
$event
->
getRequest
();
$route
=
$this
->
routes
->
get
(
$request
->
attributes
->
get
(
'_route'
));
...
...
@@ -60,7 +60,7 @@ class ConverterListener implements EventSubscriberInterface
public
static
function
getSubscribedEvents
()
{
return
array
(
KernelEvents
::
REQUEST
=>
'onKernelRequest
'
,
KernelEvents
::
CONTROLLER
=>
'onKernelController
'
,
);
}
}
tests/Silex/Tests/ApplicationTest.php
View file @
e9571ccc
...
...
@@ -125,25 +125,6 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
'foobar'
,
$response
->
getContent
());
}
public
function
testConvertedAttributeIsAvailableInBeforeFilter
()
{
$app
=
new
Application
();
$beforeValue
=
null
;
$app
->
get
(
'/foo/{foo}'
,
function
(
$foo
)
{
return
$foo
;
})
->
convert
(
'foo'
,
function
(
$foo
)
{
return
$foo
.
'converted'
;
})
->
before
(
function
(
Request
$request
)
use
(
&
$beforeValue
)
{
$beforeValue
=
$request
->
attributes
->
get
(
'foo'
);
});
$response
=
$app
->
handle
(
Request
::
create
(
'/foo/bar'
));
$this
->
assertEquals
(
'barconverted'
,
$beforeValue
);
$this
->
assertEquals
(
'barconverted'
,
$response
->
getContent
());
}
public
function
testOn
()
{
$app
=
new
Application
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment