|
| 1 | +<?php |
| 2 | + |
| 3 | + |
| 4 | +namespace TheCodingMachine\TDBM\Bundle\Tests; |
| 5 | + |
| 6 | + |
| 7 | +use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; |
| 8 | +use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; |
| 9 | +use Symfony\Component\Config\Loader\LoaderInterface; |
| 10 | +use Symfony\Component\DependencyInjection\ContainerBuilder; |
| 11 | +use Symfony\Component\HttpKernel\Kernel; |
| 12 | +use Symfony\Component\Routing\RouteCollectionBuilder; |
| 13 | +use TheCodingMachine\Graphqlite\Bundle\GraphqliteBundle; |
| 14 | +use TheCodingMachine\TDBM\Bundle\TdbmBundle; |
| 15 | +use TheCodingMachine\TDBM\Bundle\TdbmGraphqlBundle; |
| 16 | + |
| 17 | +class TdbmTestingKernel extends Kernel |
| 18 | +{ |
| 19 | + use MicroKernelTrait; |
| 20 | + |
| 21 | + const CONFIG_EXTS = '.{php,xml,yaml,yml}'; |
| 22 | + |
| 23 | + public function __construct() |
| 24 | + { |
| 25 | + parent::__construct('test', true); |
| 26 | + } |
| 27 | + |
| 28 | + public function registerBundles() |
| 29 | + { |
| 30 | + return [ |
| 31 | + new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(), |
| 32 | + new DoctrineBundle(), |
| 33 | + new TdbmBundle(), |
| 34 | + ]; |
| 35 | + } |
| 36 | + |
| 37 | + public function configureContainer(ContainerBuilder $c, LoaderInterface $loader) |
| 38 | + { |
| 39 | + $loader->load(function(ContainerBuilder $container) { |
| 40 | + $container->loadFromExtension('framework', array( |
| 41 | + 'secret' => 'S0ME_SECRET', |
| 42 | + )); |
| 43 | + $container->loadFromExtension('doctrine', array( |
| 44 | + 'dbal' => [ |
| 45 | + 'driver' => 'pdo_mysql', |
| 46 | + 'server_version' => '5.7', |
| 47 | + 'charset'=> 'utf8mb4', |
| 48 | + 'default_table_options' => [ |
| 49 | + 'charset' => 'utf8mb4', |
| 50 | + 'collate' => 'utf8mb4_unicode_ci', |
| 51 | + ], |
| 52 | + 'url' => '%env(resolve:DATABASE_URL)%' |
| 53 | + ] |
| 54 | + )); |
| 55 | + }); |
| 56 | + $confDir = $this->getProjectDir().'/Tests/Fixtures/config'; |
| 57 | + |
| 58 | + $loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob'); |
| 59 | + $loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob'); |
| 60 | + $loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob'); |
| 61 | + $loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob'); |
| 62 | + } |
| 63 | + |
| 64 | + protected function configureRoutes(RouteCollectionBuilder $routes) |
| 65 | + { |
| 66 | + } |
| 67 | + |
| 68 | + public function getCacheDir() |
| 69 | + { |
| 70 | + return __DIR__.'/../cache/'.spl_object_hash($this); |
| 71 | + } |
| 72 | +} |
0 commit comments