|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Flodaq\TicketNotificationBundle\Tests\Functional; |
| 4 | + |
| 5 | +use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; |
| 6 | +use Flodaq\TicketNotificationBundle\FlodaqTicketNotificationBundle; |
| 7 | +use Hackzilla\Bundle\TicketBundle\HackzillaTicketBundle; |
| 8 | +use Hackzilla\Bundle\TicketBundle\Tests\Functional\Entity\User; |
| 9 | +use Symfony\Bundle\FrameworkBundle\FrameworkBundle; |
| 10 | +use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; |
| 11 | +use Symfony\Bundle\SecurityBundle\SecurityBundle; |
| 12 | +use Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle; |
| 13 | +use Symfony\Component\Config\Loader\LoaderInterface; |
| 14 | +use Symfony\Component\DependencyInjection\ContainerBuilder; |
| 15 | +use Symfony\Component\HttpKernel\Kernel; |
| 16 | +use Symfony\Component\Routing\RouteCollectionBuilder; |
| 17 | + |
| 18 | +/** |
| 19 | + * @author Javier Spagnoletti <[email protected]> |
| 20 | + */ |
| 21 | +class TestKernel extends Kernel |
| 22 | +{ |
| 23 | + use MicroKernelTrait; |
| 24 | + |
| 25 | + /** |
| 26 | + * {@inheritdoc} |
| 27 | + */ |
| 28 | + public function registerBundles() |
| 29 | + { |
| 30 | + $bundles = [ |
| 31 | + new FrameworkBundle(), |
| 32 | + new SecurityBundle(), |
| 33 | + new DoctrineBundle(), |
| 34 | + new HackzillaTicketBundle(), |
| 35 | + new SwiftmailerBundle(), |
| 36 | + new FlodaqTicketNotificationBundle(), |
| 37 | + new TestBundle(), |
| 38 | + ]; |
| 39 | + |
| 40 | + return $bundles; |
| 41 | + } |
| 42 | + |
| 43 | + /** |
| 44 | + * {@inheritdoc} |
| 45 | + */ |
| 46 | + protected function configureRoutes(RouteCollectionBuilder $routes) |
| 47 | + { |
| 48 | + } |
| 49 | + |
| 50 | + /** |
| 51 | + * {@inheritdoc} |
| 52 | + */ |
| 53 | + protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader) |
| 54 | + { |
| 55 | + // FrameworkBundle config |
| 56 | + $c->loadFromExtension('framework', [ |
| 57 | + 'secret' => 'MySecretKey', |
| 58 | + 'default_locale' => 'en', |
| 59 | + 'translator' => [ |
| 60 | + 'fallbacks' => [ |
| 61 | + 'en', |
| 62 | + ], |
| 63 | + ], |
| 64 | + ]); |
| 65 | + |
| 66 | + // SecurityBundle config |
| 67 | + $c->loadFromExtension('security', [ |
| 68 | + 'providers' => [ |
| 69 | + 'in_memory' => [ |
| 70 | + 'memory' => null, |
| 71 | + ], |
| 72 | + ], |
| 73 | + 'firewalls' => [ |
| 74 | + 'main' => [ |
| 75 | + 'anonymous' => null, |
| 76 | + ], |
| 77 | + ], |
| 78 | + ]); |
| 79 | + |
| 80 | + // DoctrineBundle config |
| 81 | + $c->loadFromExtension('doctrine', [ |
| 82 | + 'dbal' => [ |
| 83 | + 'connections' => [ |
| 84 | + 'default' => [ |
| 85 | + 'driver' => 'pdo_sqlite', |
| 86 | + ], |
| 87 | + ], |
| 88 | + ], |
| 89 | + 'orm' => [ |
| 90 | + 'default_entity_manager' => 'default', |
| 91 | + ], |
| 92 | + ]); |
| 93 | + |
| 94 | + // HackzillaBundle config |
| 95 | + $c->loadFromExtension('hackzilla_ticket', [ |
| 96 | + 'user_class' => User::class, |
| 97 | + ]); |
| 98 | + |
| 99 | + // FlodaqTicketNotificationBundle config |
| 100 | + $c->loadFromExtension('flodaq_ticket_notification', [ |
| 101 | + 'emails' => [ |
| 102 | + 'sender_email' => '[email protected]', |
| 103 | + 'sender_name' => 'John Doe', |
| 104 | + ], |
| 105 | + ]); |
| 106 | + } |
| 107 | + |
| 108 | + /** |
| 109 | + * {@inheritdoc} |
| 110 | + */ |
| 111 | + public function getCacheDir() |
| 112 | + { |
| 113 | + return parent::getCacheDir(); |
| 114 | + } |
| 115 | + |
| 116 | + /** |
| 117 | + * {@inheritdoc} |
| 118 | + */ |
| 119 | + public function getLogDir() |
| 120 | + { |
| 121 | + return parent::getLogDir(); |
| 122 | + } |
| 123 | + |
| 124 | + public function unserialize($str) |
| 125 | + { |
| 126 | + $this->__construct(unserialize($str)); |
| 127 | + } |
| 128 | +} |
0 commit comments