This commit is contained in:
Guilhem Niot 2021-12-21 13:46:02 +01:00
parent b4c74ee938
commit 0fada289f5
2 changed files with 15 additions and 2 deletions

View File

@ -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 {

View File

@ -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;
}
}