Commit e9571ccc authored by Romain Neutron's avatar Romain Neutron

Fix #856: Revert a0644877 as it introduced a BC break

parent 5f449095
......@@ -13,7 +13,7 @@ namespace Silex\EventListener;
use Silex\CallbackResolver;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Event\FilterControllerEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Routing\RouteCollection;
......@@ -42,9 +42,9 @@ class ConverterListener implements EventSubscriberInterface
/**
* Handles converters.
*
* @param GetResponseEvent $event The event to handle
* @param FilterControllerEvent $event The event to handle
*/
public function onKernelRequest(GetResponseEvent $event)
public function onKernelController(FilterControllerEvent $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',
);
}
}
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment