|
23 | 23 | use Symfony\Component\Routing\Exception\ResourceNotFoundException;
|
24 | 24 | use Symfony\Component\Routing\Exception\RouteNotFoundException;
|
25 | 25 | use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
26 |
| -use Symfony\Component\Routing\Loader\ObjectRouteLoader; |
27 | 26 | use Symfony\Component\Routing\Matcher\RequestMatcherInterface;
|
28 | 27 | use Symfony\Component\Routing\RequestContext;
|
29 | 28 | use Symfony\Component\Routing\Route;
|
@@ -608,111 +607,6 @@ public function testGenerateNotFound()
|
608 | 607 | $this->router->generate($name, $parameters);
|
609 | 608 | }
|
610 | 609 |
|
611 |
| - /** |
612 |
| - * Route is an object but no versatile generator around to do the debug message. |
613 |
| - * |
614 |
| - * @group legacy |
615 |
| - * @expectedDeprecation Passing an object as route name is deprecated since version 2.3. Pass the `RouteObjectInterface::OBJECT_BASED_ROUTE_NAME` as route name and the object in the parameters with key `RouteObjectInterface::ROUTE_OBJECT`. |
616 |
| - */ |
617 |
| - public function testGenerateObjectNotFound() |
618 |
| - { |
619 |
| - if (!class_exists(ObjectRouteLoader::class)) { |
620 |
| - $this->markTestSkipped('Symfony 5 would throw a TypeError.'); |
621 |
| - } |
622 |
| - |
623 |
| - $name = new \stdClass(); |
624 |
| - $parameters = ['test' => 'value']; |
625 |
| - |
626 |
| - $defaultRouter = $this->createMock(RouterInterface::class); |
627 |
| - |
628 |
| - $defaultRouter |
629 |
| - ->expects($this->never()) |
630 |
| - ->method('generate') |
631 |
| - ; |
632 |
| - |
633 |
| - $this->router->add($defaultRouter, 200); |
634 |
| - |
635 |
| - $this->expectException(RouteNotFoundException::class); |
636 |
| - $this->router->generate($name, $parameters); |
637 |
| - } |
638 |
| - |
639 |
| - /** |
640 |
| - * A versatile router will generate the debug message. |
641 |
| - * |
642 |
| - * @group legacy |
643 |
| - * @expectedDeprecation Passing an object as route name is deprecated since version 2.3. Pass the `RouteObjectInterface::OBJECT_BASED_ROUTE_NAME` as route name and the object in the parameters with key `RouteObjectInterface::ROUTE_OBJECT`. |
644 |
| - */ |
645 |
| - public function testGenerateObjectNotFoundVersatile() |
646 |
| - { |
647 |
| - if (!class_exists(ObjectRouteLoader::class)) { |
648 |
| - $this->markTestSkipped('Symfony 5 would throw a TypeError.'); |
649 |
| - } |
650 |
| - |
651 |
| - $name = new \stdClass(); |
652 |
| - $parameters = ['test' => 'value']; |
653 |
| - |
654 |
| - $chainedRouter = $this->createMock(VersatileRouter::class); |
655 |
| - $chainedRouter |
656 |
| - ->expects($this->once()) |
657 |
| - ->method('supports') |
658 |
| - ->will($this->returnValue(true)) |
659 |
| - ; |
660 |
| - $chainedRouter->expects($this->once()) |
661 |
| - ->method('generate') |
662 |
| - ->with($name, $parameters, UrlGeneratorInterface::ABSOLUTE_PATH) |
663 |
| - ->will($this->throwException(new RouteNotFoundException())) |
664 |
| - ; |
665 |
| - $chainedRouter->expects($this->once()) |
666 |
| - ->method('getRouteDebugMessage') |
667 |
| - ->with($name, $parameters) |
668 |
| - ->will($this->returnValue('message')) |
669 |
| - ; |
670 |
| - |
671 |
| - $this->router->add($chainedRouter, 10); |
672 |
| - |
673 |
| - $this->expectException(RouteNotFoundException::class); |
674 |
| - $this->router->generate($name, $parameters); |
675 |
| - } |
676 |
| - |
677 |
| - /** |
678 |
| - * @group legacy |
679 |
| - * @expectedDeprecation Passing an object as route name is deprecated since version 2.3. Pass the `RouteObjectInterface::OBJECT_BASED_ROUTE_NAME` as route name and the object in the parameters with key `RouteObjectInterface::ROUTE_OBJECT`. |
680 |
| - */ |
681 |
| - public function testGenerateObjectName() |
682 |
| - { |
683 |
| - if (!class_exists(ObjectRouteLoader::class)) { |
684 |
| - $this->markTestSkipped('Symfony 5 would throw a TypeError.'); |
685 |
| - } |
686 |
| - |
687 |
| - $name = new \stdClass(); |
688 |
| - $parameters = ['test' => 'value']; |
689 |
| - |
690 |
| - $defaultRouter = $this->createMock(RouterInterface::class); |
691 |
| - $chainedRouter = $this->createMock(VersatileRouter::class); |
692 |
| - |
693 |
| - $defaultRouter |
694 |
| - ->expects($this->never()) |
695 |
| - ->method('generate') |
696 |
| - ; |
697 |
| - $chainedRouter |
698 |
| - ->expects($this->once()) |
699 |
| - ->method('supports') |
700 |
| - ->will($this->returnValue(true)) |
701 |
| - ; |
702 |
| - $chainedRouter |
703 |
| - ->expects($this->once()) |
704 |
| - ->method('generate') |
705 |
| - ->with($name, $parameters, UrlGeneratorInterface::ABSOLUTE_PATH) |
706 |
| - ->will($this->returnValue($name)) |
707 |
| - ; |
708 |
| - |
709 |
| - $this->router->add($defaultRouter, 200); |
710 |
| - $this->router->add($chainedRouter, 100); |
711 |
| - |
712 |
| - $result = $this->router->generate($name, $parameters); |
713 |
| - $this->assertEquals($name, $result); |
714 |
| - } |
715 |
| - |
716 | 610 | /**
|
717 | 611 | * This test currently triggers a deprecation notice because of ChainRouter BC.
|
718 | 612 | */
|
|
0 commit comments