Completed
Push — master ( 4684d1...8012f1 )
by Hugo
13s queued 11s
created

configureContainer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 9.584
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Yproximite\WannaSpeakBundle\Tests;
4
5
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
6
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\HttpKernel\Kernel;
9
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
10
use Symfony\Component\Routing\RouteCollectionBuilder;
11
use Yproximite\WannaSpeakBundle\WannaSpeakBundle;
12
13
abstract class AbstractWannaSpeakBundleTestKernel extends Kernel
14
{
15
    use MicroKernelTrait;
16
17
    public function __construct()
18
    {
19
        parent::__construct('test', true);
20
    }
21
22
    public function registerBundles(): iterable
23
    {
24
        return [
25
            new FrameworkBundle(),
26
            new WannaSpeakBundle(),
27
        ];
28
    }
29
30
    protected function configureContainer(ContainerBuilder $containerBuilder): void
31
    {
32
        $containerBuilder->loadFromExtension('framework', [
33
            'secret' => 'my-secret',
34
            'test'   => true,
35
            'router' => [
36
                'utf8' => true,
37
            ]
38
        ]);
39
40
        $containerBuilder->loadFromExtension('wanna_speak', [
41
            'api' => [
42
                'credentials' => [
43
                    'account_id' => '9999999999',
44
                    'secret_key' => '0000000000',
45
                ],
46
                'base_url' => 'https://www-2.wannaspeak.com/api/api.php',
47
                'test' => true,
48
            ],
49
        ]);
50
    }
51
}
52
53
54
if (AbstractWannaSpeakBundleTestKernel::VERSION_ID >= 50100) { // @phpstan-ignore-line
55
    class WannaSpeakBundleTestKernel extends AbstractWannaSpeakBundleTestKernel
56
    {
57
        protected function configureRoutes(RoutingConfigurator $routes): void
58
        {
59
        }
60
    }
61
} else { // @phpstan-ignore-line
62
    class WannaSpeakBundleTestKernel extends AbstractWannaSpeakBundleTestKernel
0 ignored issues
show
Comprehensibility Best Practice introduced by
The type Yproximite\WannaSpeakBun...naSpeakBundleTestKernel has been defined more than once; this definition is ignored, only the first definition in this file (L55-60) is considered.

This check looks for classes that have been defined more than once in the same file.

If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.

This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.

Loading history...
63
    {
64
        protected function configureRoutes(RouteCollectionBuilder $routes): void
65
        {
66
        }
67
    }
68
}
69