|
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\NotificationBundle\SonataNotificationBundle; |
|
21
|
|
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; |
|
22
|
|
|
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; |
|
23
|
|
|
use Symfony\Bundle\SecurityBundle\SecurityBundle; |
|
24
|
|
|
use Symfony\Bundle\TwigBundle\TwigBundle; |
|
25
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface; |
|
26
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
27
|
|
|
use Symfony\Component\HttpKernel\Kernel; |
|
28
|
|
|
use Symfony\Component\Routing\RouteCollectionBuilder; |
|
29
|
|
|
|
|
30
|
|
|
final class AppKernel extends Kernel |
|
31
|
|
|
{ |
|
32
|
|
|
use MicroKernelTrait; |
|
33
|
|
|
|
|
34
|
|
|
public function __construct() |
|
35
|
|
|
{ |
|
36
|
|
|
parent::__construct('test', false); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
public function registerBundles() |
|
40
|
|
|
{ |
|
41
|
|
|
return [ |
|
42
|
|
|
new FrameworkBundle(), |
|
43
|
|
|
new SecurityBundle(), |
|
44
|
|
|
new TwigBundle(), |
|
45
|
|
|
new FOSRestBundle(), |
|
46
|
|
|
new SonataNotificationBundle(), |
|
47
|
|
|
new JMSSerializerBundle(), |
|
48
|
|
|
new DoctrineBundle(), |
|
49
|
|
|
new NelmioApiDocBundle(), |
|
50
|
|
|
]; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function getCacheDir(): string |
|
54
|
|
|
{ |
|
55
|
|
|
return $this->getBaseDir().'cache'; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function getLogDir(): string |
|
59
|
|
|
{ |
|
60
|
|
|
return $this->getBaseDir().'log'; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function getProjectDir(): string |
|
64
|
|
|
{ |
|
65
|
|
|
return __DIR__; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
protected function configureRoutes(RouteCollectionBuilder $routes) |
|
69
|
|
|
{ |
|
70
|
|
|
$routes->import($this->getProjectDir().'/config/routes.yaml'); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void |
|
|
|
|
|
|
74
|
|
|
{ |
|
75
|
|
|
$containerBuilder->register('templating')->setSynthetic(true); |
|
76
|
|
|
$containerBuilder->register('templating.locator')->setSynthetic(true); |
|
77
|
|
|
$containerBuilder->register('templating.name_parser')->setSynthetic(true); |
|
78
|
|
|
$containerBuilder->register('mailer')->setSynthetic(true); |
|
79
|
|
|
|
|
80
|
|
|
$containerBuilder->loadFromExtension('framework', [ |
|
81
|
|
|
'secret' => '50n474.U53r', |
|
82
|
|
|
'session' => [ |
|
83
|
|
|
'handler_id' => 'session.handler.native_file', |
|
84
|
|
|
'storage_id' => 'session.storage.mock_file', |
|
85
|
|
|
'name' => 'MOCKSESSID', |
|
86
|
|
|
], |
|
87
|
|
|
'translator' => null, |
|
88
|
|
|
'validation' => [ |
|
89
|
|
|
'enabled' => true, |
|
90
|
|
|
], |
|
91
|
|
|
'form' => [ |
|
92
|
|
|
'enabled' => true, |
|
93
|
|
|
], |
|
94
|
|
|
'assets' => null, |
|
95
|
|
|
'test' => true, |
|
96
|
|
|
'profiler' => [ |
|
97
|
|
|
'enabled' => true, |
|
98
|
|
|
'collect' => false, |
|
99
|
|
|
], |
|
100
|
|
|
]); |
|
101
|
|
|
|
|
102
|
|
|
$containerBuilder->loadFromExtension('security', [ |
|
103
|
|
|
'firewalls' => ['api' => ['anonymous' => true]], |
|
104
|
|
|
'providers' => ['in_memory' => ['memory' => null]], |
|
105
|
|
|
]); |
|
106
|
|
|
|
|
107
|
|
|
$containerBuilder->loadFromExtension('twig', [ |
|
108
|
|
|
'strict_variables' => '%kernel.debug%', |
|
109
|
|
|
'exception_controller' => null, |
|
110
|
|
|
]); |
|
111
|
|
|
|
|
112
|
|
|
$containerBuilder->loadFromExtension('doctrine', [ |
|
113
|
|
|
'dbal' => [ |
|
114
|
|
|
'connections' => [ |
|
115
|
|
|
'default' => [ |
|
116
|
|
|
'driver' => 'pdo_sqlite', |
|
117
|
|
|
], |
|
118
|
|
|
], |
|
119
|
|
|
], |
|
120
|
|
|
'orm' => [ |
|
121
|
|
|
'default_entity_manager' => 'default', |
|
122
|
|
|
], |
|
123
|
|
|
]); |
|
124
|
|
|
|
|
125
|
|
|
$containerBuilder->loadFromExtension('fos_rest', [ |
|
126
|
|
|
'param_fetcher_listener' => true, |
|
127
|
|
|
]); |
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
private function getBaseDir(): string |
|
131
|
|
|
{ |
|
132
|
|
|
return sys_get_temp_dir().'/sonata-notification-bundle/var/'; |
|
133
|
|
|
} |
|
134
|
|
|
} |
|
135
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.