1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* This file is part of the Sonata Project package. |
7
|
|
|
* |
8
|
|
|
* (c) Thomas Rabaix <[email protected]> |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, please view the LICENSE |
11
|
|
|
* file that was distributed with this source code. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Sonata\NotificationBundle\Tests\App; |
15
|
|
|
|
16
|
|
|
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; |
17
|
|
|
use FOS\RestBundle\FOSRestBundle; |
18
|
|
|
use JMS\SerializerBundle\JMSSerializerBundle; |
19
|
|
|
use Nelmio\ApiDocBundle\NelmioApiDocBundle; |
20
|
|
|
use Sonata\Doctrine\Bridge\Symfony\SonataDoctrineBundle; |
21
|
|
|
use Sonata\Form\Bridge\Symfony\SonataFormBundle; |
22
|
|
|
use Sonata\NotificationBundle\SonataNotificationBundle; |
23
|
|
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; |
24
|
|
|
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; |
25
|
|
|
use Symfony\Bundle\SecurityBundle\SecurityBundle; |
26
|
|
|
use Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle; |
27
|
|
|
use Symfony\Bundle\TwigBundle\TwigBundle; |
28
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface; |
29
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
30
|
|
|
use Symfony\Component\HttpKernel\Kernel; |
31
|
|
|
use Symfony\Component\Routing\RouteCollectionBuilder; |
32
|
|
|
|
33
|
|
|
final class AppKernel extends Kernel |
34
|
|
|
{ |
35
|
|
|
use MicroKernelTrait; |
36
|
|
|
|
37
|
|
|
public function __construct() |
38
|
|
|
{ |
39
|
|
|
parent::__construct('test', false); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
public function registerBundles() |
43
|
|
|
{ |
44
|
|
|
return [ |
45
|
|
|
new FrameworkBundle(), |
46
|
|
|
new SecurityBundle(), |
47
|
|
|
new TwigBundle(), |
48
|
|
|
new FOSRestBundle(), |
49
|
|
|
new SonataDoctrineBundle(), |
50
|
|
|
new SonataNotificationBundle(), |
51
|
|
|
new JMSSerializerBundle(), |
52
|
|
|
new DoctrineBundle(), |
53
|
|
|
new NelmioApiDocBundle(), |
54
|
|
|
new SwiftmailerBundle(), |
55
|
|
|
new SonataFormBundle(), |
56
|
|
|
]; |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function getCacheDir(): string |
60
|
|
|
{ |
61
|
|
|
return $this->getBaseDir().'cache'; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function getLogDir(): string |
65
|
|
|
{ |
66
|
|
|
return $this->getBaseDir().'log'; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function getProjectDir(): string |
70
|
|
|
{ |
71
|
|
|
return __DIR__; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
protected function configureRoutes(RouteCollectionBuilder $routes) |
75
|
|
|
{ |
76
|
|
|
$routes->import($this->getProjectDir().'/config/routes.yaml'); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void |
80
|
|
|
{ |
81
|
|
|
$loader->load(__DIR__.'/config/config.yml'); |
82
|
|
|
$loader->load(__DIR__.'/config/security.yml'); |
83
|
|
|
|
84
|
|
|
$containerBuilder->setParameter('app.base_dir', $this->getBaseDir()); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
private function getBaseDir(): string |
88
|
|
|
{ |
89
|
|
|
return sys_get_temp_dir().'/sonata-notification-bundle/var/'; |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
|