DumpedUrlMatcherTest.php 839 B

123456789101112131415161718192021222324252627282930
  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\Matcher;
  11. use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper;
  12. use Symfony\Component\Routing\RequestContext;
  13. use Symfony\Component\Routing\RouteCollection;
  14. class DumpedUrlMatcherTest extends UrlMatcherTest
  15. {
  16. protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null)
  17. {
  18. static $i = 0;
  19. $class = 'DumpedUrlMatcher'.++$i;
  20. $dumper = new PhpMatcherDumper($routes);
  21. eval('?>'.$dumper->dump(['class' => $class]));
  22. return new $class($context ?: new RequestContext());
  23. }
  24. }