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
34
34
);
35
35
36
36
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 ' );
45
39
}
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
- });
53
40
})
54
41
;
55
42
}
Original file line number Diff line number Diff line change 4
4
5
5
use Symfony \Bundle \FrameworkBundle \Controller \AbstractController ;
6
6
use Symfony \Component \HttpFoundation \Response ;
7
+ use Symfony \Component \Routing \Annotation \Route ;
7
8
8
9
class TestingController extends AbstractController
9
10
{
11
+ #[Route(path: '/ ' , name: 'app_homepage ' )]
10
12
public function homepage ()
11
13
{
12
14
$ this ->denyAccessUnlessGranted ('ROLE_USER ' );
13
15
14
16
return new Response ('Page Success ' );
15
17
}
16
18
19
+ #[Route(path: '/anonymous ' , name: 'app_anonymous ' )]
17
20
public function anonymous ()
18
21
{
19
22
return new Response ('Page Success ' );
You can’t perform that action at this time.
0 commit comments