File tree Expand file tree Collapse file tree 2 files changed +5
-15
lines changed
fixtures/make-registration-form/standard_setup/src/Controller Expand file tree Collapse file tree 2 files changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -34,22 +34,9 @@ private function createRegistrationFormTest(): MakerTestDetails
3434 );
3535
3636 if (60000 > $ runner ->getSymfonyVersion ()) {
37- /*
38- * @Legacy - Drop when Symfony 6.0 is LTS
39- *
40- * This is a round about way to handle empty yaml files and YamlSourceManipulator.
41- * Prior to Symfony 6.0, the routes.yaml was empty w/ a comment line. YSM
42- * requires a top level array structure to manipulate them.
43- */
44- $ runner ->writeFile ('config/routes.yaml ' , 'app_homepage: ' );
37+ // @legacy - In 5.4 tests, we need to tell Symfony to look for the route attributes in `src/Controller`
38+ $ runner ->copy ('router-annotations.yaml ' , 'config/routes/annotations.yaml ' );
4539 }
46-
47- $ runner ->modifyYamlFile ('config/routes.yaml ' , function (array $ yaml ) {
48- $ yaml ['app_homepage ' ] = ['path ' => '/ ' , 'controller ' => 'App\Controller\TestingController::homepage ' ];
49- $ yaml ['app_anonymous ' ] = ['path ' => '/anonymous ' , 'controller ' => 'App\Controller\TestingController::anonymous ' ];
50-
51- return $ yaml ;
52- });
5340 })
5441 ;
5542 }
Original file line number Diff line number Diff line change 44
55use Symfony \Bundle \FrameworkBundle \Controller \AbstractController ;
66use Symfony \Component \HttpFoundation \Response ;
7+ use Symfony \Component \Routing \Annotation \Route ;
78
89class TestingController extends AbstractController
910{
11+ #[Route(path: '/ ' , name: 'app_homepage ' )]
1012 public function homepage ()
1113 {
1214 $ this ->denyAccessUnlessGranted ('ROLE_USER ' );
1315
1416 return new Response ('Page Success ' );
1517 }
1618
19+ #[Route(path: '/anonymous ' , name: 'app_anonymous ' )]
1720 public function anonymous ()
1821 {
1922 return new Response ('Page Success ' );
You can’t perform that action at this time.
0 commit comments