|
| 1 | +<?php |
| 2 | + |
| 3 | +/** |
| 4 | + * @copyright Copyright (C) Ibexa AS. All rights reserved. |
| 5 | + * @license For full copyright and license information view LICENSE file distributed with this source code. |
| 6 | + */ |
| 7 | +declare(strict_types=1); |
| 8 | + |
| 9 | +namespace Ibexa\Tests\Integration\Rest; |
| 10 | + |
| 11 | +use Hautelook\TemplatedUriBundle\HautelookTemplatedUriBundle; |
| 12 | +use Ibexa\Bundle\Rest\IbexaRestBundle; |
| 13 | +use Ibexa\Contracts\Test\Core\IbexaTestKernel as CoreIbexaTestKernel; |
| 14 | +use Ibexa\Rest\Server\Controller\Root as RestRootController; |
| 15 | +use Lexik\Bundle\JWTAuthenticationBundle\Services\JWTTokenManagerInterface; |
| 16 | +use Symfony\Component\Config\Loader\LoaderInterface; |
| 17 | +use Symfony\Component\DependencyInjection\ContainerBuilder; |
| 18 | + |
| 19 | +final class IbexaTestKernel extends CoreIbexaTestKernel |
| 20 | +{ |
| 21 | + public function registerBundles(): iterable |
| 22 | + { |
| 23 | + yield from parent::registerBundles(); |
| 24 | + |
| 25 | + yield new HautelookTemplatedUriBundle(); |
| 26 | + yield new IbexaRestBundle(); |
| 27 | + } |
| 28 | + |
| 29 | + public function registerContainerConfiguration(LoaderInterface $loader): void |
| 30 | + { |
| 31 | + parent::registerContainerConfiguration($loader); |
| 32 | + |
| 33 | + $loader->load(static function (ContainerBuilder $container): void { |
| 34 | + self::addSyntheticService($container, JWTTokenManagerInterface::class); |
| 35 | + |
| 36 | + self::loadRouting($container); |
| 37 | + }); |
| 38 | + } |
| 39 | + |
| 40 | + protected static function getExposedServicesByClass(): iterable |
| 41 | + { |
| 42 | + yield from parent::getExposedServicesByClass(); |
| 43 | + yield RestRootController::class; |
| 44 | + } |
| 45 | + |
| 46 | + private static function loadRouting(ContainerBuilder $container): void |
| 47 | + { |
| 48 | + $container->loadFromExtension('framework', [ |
| 49 | + 'router' => [ |
| 50 | + 'resource' => __DIR__ . '/Resources/test_routing.yaml', |
| 51 | + ], |
| 52 | + ]); |
| 53 | + } |
| 54 | +} |
0 commit comments