AnnotatedControllerTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
  11. class AnnotatedControllerTest extends WebTestCase
  12. {
  13. /**
  14. * @dataProvider getRoutes
  15. */
  16. public function testAnnotatedController($path, $expectedValue)
  17. {
  18. $client = $this->createClient(array('test_case' => 'AnnotatedController', 'root_config' => 'config.yml'));
  19. $client->request('GET', '/annotated'.$path);
  20. $this->assertSame(200, $client->getResponse()->getStatusCode());
  21. $this->assertSame($expectedValue, $client->getResponse()->getContent());
  22. }
  23. public function getRoutes()
  24. {
  25. return array(
  26. array('/null_request', 'Symfony\Component\HttpFoundation\Request'),
  27. array('/null_argument', ''),
  28. array('/null_argument_with_route_param', ''),
  29. array('/null_argument_with_route_param/value', 'value'),
  30. array('/argument_with_route_param_and_default', 'value'),
  31. array('/argument_with_route_param_and_default/custom', 'custom'),
  32. );
  33. }
  34. }