Issues (44)

Tests/TestKernel.php (3 issues)

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();
0 ignored issues
show
The type GGGGino\SkuskuCartBundle\Tests\JMSSerializerBundle was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
48
49
            if ($this->useBazinga) {
50
                $bundles[] = new BazingaHateoasBundle();
0 ignored issues
show
The type GGGGino\SkuskuCartBundle...ts\BazingaHateoasBundle was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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
The parameter $loader is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

68
    protected function configureContainer(ContainerBuilder $c, /** @scrutinizer ignore-unused */ LoaderInterface $loader)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
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
}