diff --git a/Tests/Functional/TestKernel.php b/Tests/Functional/TestKernel.php index 74de9ec..a865e78 100644 --- a/Tests/Functional/TestKernel.php +++ b/Tests/Functional/TestKernel.php @@ -31,7 +31,6 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; -use Symfony\Component\Routing\RouteCollectionBuilder; use Symfony\Component\Serializer\Annotation\SerializedName; class TestKernel extends Kernel @@ -112,7 +111,8 @@ class TestKernel extends Kernel /** * BC for sf < 5.1. */ - private function import($routes, $resource, $prefix, $type) { + private function import($routes, $resource, $prefix, $type) + { if ($routes instanceof RoutingConfigurator) { $routes->withPath($prefix)->import($resource, $type); } else { diff --git a/Tests/Functional/WebTestCase.php b/Tests/Functional/WebTestCase.php index c792c0d..54bfdde 100644 --- a/Tests/Functional/WebTestCase.php +++ b/Tests/Functional/WebTestCase.php @@ -14,6 +14,7 @@ namespace Nelmio\ApiDocBundle\Tests\Functional; use OpenApi\Annotations as OA; use OpenApi\Generator; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpKernel\KernelInterface; class WebTestCase extends BaseWebTestCase @@ -168,4 +169,16 @@ class WebTestCase extends BaseWebTestCase sprintf('Failed asserting that property "%s" does not exist.', $property) ); } + + /** + * BC symfony < 5.3 + */ + protected static function getContainer(): ContainerInterface + { + if (method_exists(parent::class, 'getContainer')) { + return parent::getContainer(); + } + + return static::$container; + } }