|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* (c) Kévin Dunglas <[email protected]> |
|
5
|
|
|
* |
|
6
|
|
|
* This source file is subject to the MIT license that is bundled |
|
7
|
|
|
* with this source code in the file LICENSE. |
|
8
|
|
|
*/ |
|
9
|
|
|
|
|
10
|
|
|
use Dunglas\ActionBundle\DunglasActionBundle; |
|
11
|
|
|
use Dunglas\ActionBundle\Tests\Fixtures\TestBundle\TestBundle; |
|
12
|
|
|
use Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle; |
|
13
|
|
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle; |
|
14
|
|
|
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; |
|
15
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface; |
|
16
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
17
|
|
|
use Symfony\Component\HttpKernel\Kernel; |
|
18
|
|
|
use Symfony\Component\Routing\RouteCollectionBuilder; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @author Kévin Dunglas <[email protected]> |
|
22
|
|
|
*/ |
|
23
|
|
|
final class TestKernel extends Kernel |
|
24
|
|
|
{ |
|
25
|
|
|
use MicroKernelTrait; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* {@inheritdoc} |
|
29
|
|
|
*/ |
|
30
|
|
|
public function registerBundles() |
|
31
|
|
|
{ |
|
32
|
|
|
return [ |
|
33
|
|
|
new FrameworkBundle(), |
|
34
|
|
|
new DunglasActionBundle(), |
|
35
|
|
|
new SensioFrameworkExtraBundle(), |
|
36
|
|
|
new TestBundle(), |
|
37
|
|
|
]; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* {@inheritdoc} |
|
42
|
|
|
*/ |
|
43
|
|
|
protected function configureRoutes(RouteCollectionBuilder $routes) |
|
44
|
|
|
{ |
|
45
|
|
|
// Specify explicitly the controller |
|
46
|
|
|
$routes->add('/', 'action.Dunglas\ActionBundle\Tests\Fixtures\TestBundle\Action\DummyAction', 'dummy'); |
|
47
|
|
|
// Use the @Route annotation of SensioExtraFrameworkBundle |
|
48
|
|
|
$routes->import('@TestBundle/Action/', '/', 'annotation'); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* {@inheritdoc} |
|
53
|
|
|
*/ |
|
54
|
|
|
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader) |
|
55
|
|
|
{ |
|
56
|
|
|
$c->loadFromExtension('framework', [ |
|
57
|
|
|
'secret' => 'MySecretKey', |
|
58
|
|
|
'test' => null, |
|
59
|
|
|
]); |
|
60
|
|
|
|
|
61
|
|
|
$c->register('action.Dunglas\ActionBundle\Tests\Fixtures\TestBundle\Action\OverrideAction', 'Dunglas\ActionBundle\Tests\Fixtures\TestBundle\Action\OverrideAction'); |
|
62
|
|
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|