Completed
Pull Request — master (#3)
by Ramūnas
13:15
created

Kernel::setRegistrableBundles()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace RDV\Bundle\MigrationBundle\Tests\Functional\Fixture;
4
5
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
6
use RDV\Bundle\MigrationBundle\RdvMigrationBundle;
7
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
8
use Symfony\Bundle\TwigBundle\TwigBundle;
9
use Symfony\Component\Config\Loader\LoaderInterface;
10
use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest;
11
12
class Kernel extends KernelForTest
13
{
14
    /** @var array */
15
    protected $registrableBundles = array();
16
17
    /** @var \Closure */
18
    protected $configCallback;
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function registerBundles()
24
    {
25
        $bundles = [
26
            new FrameworkBundle(),
27
            new TwigBundle(),
28
            new DoctrineBundle(),
29
            new RdvMigrationBundle(),
30
        ];
31
32
        return array_merge($bundles, $this->registrableBundles);
33
    }
34
35
    /**
36
     * @param array $bundles
37
     * @return $this
38
     */
39
    public function setRegistrableBundles($bundles)
40
    {
41
        $this->registrableBundles = $bundles;
42
43
        return $this;
44
    }
45
46
    /**
47
     * @param \Closure $callback
48
     * @return $this
49
     */
50
    public function setConfigCallback(\Closure $callback)
51
    {
52
        $this->configCallback = $callback;
53
54
        return $this;
55
    }
56
57
    /**
58
     * {@inheritdoc}
59
     */
60
    public function registerContainerConfiguration(LoaderInterface $loader)
61
    {
62
        $loader->load(__DIR__ . '/config.yml');
63
        if (is_callable($this->configCallback)) {
64
            $loader->load($this->configCallback);
65
        }
66
    }
67
}
68