File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed
fixtures/MakeControllerAttributes/tests Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -106,5 +106,15 @@ public function getTestDetails()
106
106
$ this ->assertStringContainsString ('created: templates/foo/bar/cool/index.html.twig ' , $ output );
107
107
}),
108
108
];
109
+
110
+ yield 'controller_uses_attributes ' => [MakerTestDetails::createTest (
111
+ $ this ->getMakerInstance (MakeController::class),
112
+ [
113
+ 'AttributeController ' ,
114
+ ])
115
+ ->addExtraDependencies ('twig ' )
116
+ ->setRequiredPhpVersion (80000 )
117
+ ->setFixtureFilesPath (__DIR__ .'/../fixtures/MakeControllerAttributes ' ),
118
+ ];
109
119
}
110
120
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace App \Tests ;
4
+
5
+ use Symfony \Bundle \FrameworkBundle \Test \WebTestCase ;
6
+
7
+ /**
8
+ * @author Jesse Rushlow <[email protected] >
9
+ */
10
+ class GeneratedControllerTest extends WebTestCase
11
+ {
12
+ /**
13
+ * This tests passes as is, but I can do better.....
14
+ */
15
+ public function testControllerHasRouteAttribute (): void
16
+ {
17
+ self ::markTestIncomplete ('Im a WIP ' );
18
+
19
+ $ reflected = new \ReflectionClass (\App \Controller \AttributeController::class);
20
+
21
+ $ methodAttributes = $ reflected ->getMethods ()[0 ]->getAttributes ();
22
+
23
+ self ::assertCount (1 , $ methodAttributes );
24
+
25
+ $ attributeName = $ methodAttributes [0 ]->getName ();
26
+
27
+ self ::assertSame ('Symfony\Component\Routing\Annotation\Route ' , $ attributeName );
28
+ }
29
+ }
You can’t perform that action at this time.
0 commit comments