mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-25 04:03:55 +01:00
Add test case for route annotation with optional parameters
This commit is contained in:
parent
e2b34f1e7e
commit
9edff1852a
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class WithRouteOptions
|
||||
{
|
||||
/**
|
||||
* @Route("/{category}", name="report_overview", defaults={"category" = null}, requirements={"category" = "\d+"})
|
||||
* @Template("PAPPReportBundle:Report:report_list.html.twig")
|
||||
*/
|
||||
public function index($category = null)
|
||||
{
|
||||
return [
|
||||
'category' => $category,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
|
||||
class WithRouteOptions
|
||||
{
|
||||
/**
|
||||
* @Route("/{category}", name="report_overview", defaults={"category" = null}, requirements={"category" = "\d+"})
|
||||
*/
|
||||
public function index($category = null)
|
||||
{
|
||||
return $this->render('PAPPReportBundle:Report:report_list.html.twig', [
|
||||
'category' => $category,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
1
packages/Sensio/tests/Rector/FrameworkExtraBundle/TemplateAnnotationRector/TemplateAnnotationVersion5RectorTest.php
Normal file → Executable file
1
packages/Sensio/tests/Rector/FrameworkExtraBundle/TemplateAnnotationRector/TemplateAnnotationVersion5RectorTest.php
Normal file → Executable file
@ -26,6 +26,7 @@ final class TemplateAnnotationVersion5RectorTest extends AbstractRectorTestCase
|
||||
yield [__DIR__ . '/Fixture/Version5/fixture4.php.inc'];
|
||||
yield [__DIR__ . '/Fixture/Version5/fixture5.php.inc'];
|
||||
yield [__DIR__ . '/Fixture/Version5/with_route_too.php.inc'];
|
||||
yield [__DIR__ . '/Fixture/Version5/with_route_options.php.inc'];
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user