File tree Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Expand file tree Collapse file tree 3 files changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ /*
4+ * This file is part of the FOSRestBundle package.
5+ *
6+ * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
7+ *
8+ * For the full copyright and license information, please view the LICENSE
9+ * file that was distributed with this source code.
10+ */
11+
12+ namespace FOS \RestBundle \Tests \Functional \Bundle \TestBundle \Controller ;
13+
14+ use FOS \RestBundle \Controller \Annotations \Get ;
15+ use FOS \RestBundle \Controller \Annotations \Version ;
16+ use FOS \RestBundle \Controller \Annotations \View ;
17+
18+ /**
19+ * @author Ener-Getick <[email protected] > 20+ *
21+ * @Version({"1.2"})
22+ */
23+ class Version2Controller
24+ {
25+ /**
26+ * @View("TestBundle:Version:version.html.twig")
27+ * @Get(path="/version")
28+ */
29+ public function versionAction ($ version )
30+ {
31+ return array ('version ' => 'test annotation ' );
32+ }
33+ }
Original file line number Diff line number Diff line change @@ -14,7 +14,12 @@ test_serializer_error_invalid_form:
1414 path : /serializer-error/invalid-form.{_format}
1515 defaults : { _controller: TestBundle:SerializerError:invalidForm }
1616
17+ # Must be defined before test_version
1718test_version2 :
19+ resource : FOS\RestBundle\Tests\Functional\Bundle\TestBundle\Controller\Version2Controller
20+ type : rest
21+
22+ test_version :
1823 path : /version
1924 defaults : { _controller: TestBundle:Version:version }
2025 requirements :
Original file line number Diff line number Diff line change @@ -23,6 +23,15 @@ public function setUp()
2323 $ this ->client = $ this ->createClient (['test_case ' => 'Version ' ]);
2424 }
2525
26+ public function testVersionAnnotation ()
27+ {
28+ $ this ->client ->request (
29+ 'GET ' ,
30+ '/version?query_version=1.2 '
31+ );
32+ $ this ->assertContains ('test annotation ' , $ this ->client ->getResponse ()->getContent ());
33+ }
34+
2635 public function testCustomHeaderVersion ()
2736 {
2837 $ this ->client ->request (
You can’t perform that action at this time.
0 commit comments