1 | <?php |
||
2 | |||
3 | namespace GGGGino\SkuskuCartBundle\Tests; |
||
4 | |||
5 | use Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle; |
||
6 | use Symfony\Bundle\FrameworkBundle\FrameworkBundle; |
||
7 | use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; |
||
8 | use Symfony\Bundle\TwigBundle\TwigBundle; |
||
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 | |||
14 | class TestKernel extends Kernel |
||
15 | { |
||
16 | use MicroKernelTrait; |
||
17 | |||
18 | private $useJMS; |
||
19 | private $useBazinga; |
||
20 | |||
21 | public function __construct(bool $useJMS = false, bool $useBazinga = false) |
||
22 | { |
||
23 | parent::__construct('test'.(int) $useJMS.(int) $useBazinga, true); |
||
24 | |||
25 | $this->useJMS = $useJMS; |
||
26 | $this->useBazinga = $useBazinga; |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * {@inheritdoc} |
||
31 | */ |
||
32 | public function registerBundles() |
||
33 | { |
||
34 | $bundles = [ |
||
35 | new FrameworkBundle(), |
||
36 | new \Symfony\Bundle\SecurityBundle\SecurityBundle(), |
||
37 | new TwigBundle(), |
||
38 | new \Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), |
||
39 | new SensioFrameworkExtraBundle(), |
||
40 | new \Craue\FormFlowBundle\CraueFormFlowBundle(), |
||
41 | new \Payum\Bundle\PayumBundle\PayumBundle(), |
||
42 | new \GGGGino\SkuskuCartBundle\GGGGinoSkuskuCartBundle(), |
||
43 | new \Symfony\Bundle\WebProfilerBundle\WebProfilerBundle() |
||
44 | ]; |
||
45 | |||
46 | if ($this->useJMS) { |
||
47 | $bundles[] = new JMSSerializerBundle(); |
||
48 | |||
49 | if ($this->useBazinga) { |
||
50 | $bundles[] = new BazingaHateoasBundle(); |
||
51 | } |
||
52 | } |
||
53 | |||
54 | return $bundles; |
||
55 | } |
||
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | */ |
||
60 | protected function configureRoutes(RouteCollectionBuilder $routes) |
||
61 | { |
||
62 | $routes->import(dirname(__DIR__.'/Controller/CartController.php'), '/', 'annotation'); |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader) |
||
0 ignored issues
–
show
|
|||
69 | { |
||
70 | $c->loadFromExtension('framework', [ |
||
71 | 'secret' => 'MySecretKey', |
||
72 | 'test' => null, |
||
73 | 'validation' => null, |
||
74 | 'form' => null, |
||
75 | 'templating' => [ |
||
76 | 'engines' => ['twig'], |
||
77 | ] |
||
78 | ]); |
||
79 | } |
||
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | public function getCacheDir() |
||
85 | { |
||
86 | return parent::getCacheDir().'/'.(int) $this->useJMS; |
||
87 | } |
||
88 | |||
89 | /** |
||
90 | * {@inheritdoc} |
||
91 | */ |
||
92 | public function getLogDir() |
||
93 | { |
||
94 | return parent::getLogDir().'/'.(int) $this->useJMS; |
||
95 | } |
||
96 | |||
97 | /** |
||
98 | * @param \Symfony\Component\Config\Loader\LoaderInterface $loader |
||
99 | */ |
||
100 | public function registerContainerConfiguration(LoaderInterface $loader) |
||
101 | { |
||
102 | $loader->load(__DIR__ . '/app/config/config.yml'); |
||
103 | } |
||
104 | |||
105 | public function serialize() |
||
106 | { |
||
107 | return serialize($this->useJMS); |
||
108 | } |
||
109 | |||
110 | public function unserialize($str) |
||
111 | { |
||
112 | $this->__construct(unserialize($str)); |
||
113 | } |
||
114 | } |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.