AnnotationClassLoaderWithAttributesTest.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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\Component\Routing\Tests\Loader;
  11. use Symfony\Component\Routing\Loader\AnnotationClassLoader;
  12. use Symfony\Component\Routing\Route;
  13. /**
  14. * @requires PHP 8
  15. */
  16. class AnnotationClassLoaderWithAttributesTest extends AnnotationClassLoaderTestCase
  17. {
  18. protected function setUp(string $env = null): void
  19. {
  20. $this->loader = new class(null, $env) extends AnnotationClassLoader {
  21. protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, object $annot): void
  22. {
  23. }
  24. };
  25. }
  26. public function testDefaultRouteName()
  27. {
  28. $routeCollection = $this->loader->load($this->getNamespace().'\EncodingClass');
  29. $defaultName = array_keys($routeCollection->all())[0];
  30. $this->assertSame('symfony_component_routing_tests_fixtures_attributefixtures_encodingclass_routeàction', $defaultName);
  31. }
  32. protected function getNamespace(): string
  33. {
  34. return 'Symfony\Component\Routing\Tests\Fixtures\AttributeFixtures';
  35. }
  36. }