AppKernel   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 91
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 31

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 31
dl 0
loc 91
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 3
A registerBundles() 0 50 1
A registerContainerConfiguration() 0 4 1
A getCacheDir() 0 4 1
A serialize() 0 4 1
A unserialize() 0 4 1
1
<?php
2
3
namespace Alpixel\Bundle\CMSBundle\Tests\Functional;
4
5
use JMS\TranslationBundle\Exception\RuntimeException;
6
use Symfony\Component\Config\Loader\LoaderInterface;
7
use Symfony\Component\Filesystem\Filesystem;
8
use Symfony\Component\HttpKernel\Kernel;
9
10
/**
11
 * @author Benjamin HUBERT <[email protected]>
12
 */
13
class AppKernel extends Kernel
14
{
15
    private $config;
16
17
    public function __construct($config)
18
    {
19
        parent::__construct('test', true);
20
21
        $fs = new Filesystem();
22
        if (!$fs->isAbsolutePath($config)) {
23
            $config = __DIR__.'/config/'.$config;
24
        }
25
26
        if (!file_exists($config)) {
27
            throw new RuntimeException(sprintf('The config file "%s" does not exist.', $config));
28
        }
29
30
        $this->config = $config;
31
    }
32
33
    public function registerBundles()
34
    {
35
        return [
36
            //Symfony
37
            new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
38
            new \Symfony\Bundle\SecurityBundle\SecurityBundle(),
39
            new \Symfony\Bundle\TwigBundle\TwigBundle(),
40
            new \Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
41
42
            //Doctrine
43
            new \Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
44
            new \Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle(),
45
46
            // Admin
47
            new \Sonata\CoreBundle\SonataCoreBundle(),
48
            new \Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
49
            new \Sonata\AdminBundle\SonataAdminBundle(),
50
            new \Sonata\BlockBundle\SonataBlockBundle(),
51
            new \Ivory\CKEditorBundle\IvoryCKEditorBundle(),
52
            new \Pix\SortableBehaviorBundle\PixSortableBehaviorBundle(),
53
            new \Knp\Bundle\MenuBundle\KnpMenuBundle(),
54
55
            //i18n
56
            new \Lunetics\LocaleBundle\LuneticsLocaleBundle(),
57
58
            //i18n : Translation
59
            new \JMS\TranslationBundle\JMSTranslationBundle(),
60
            new \JMS\I18nRoutingBundle\JMSI18nRoutingBundle(),
61
            new \Happyr\TranslationBundle\HappyrTranslationBundle(),
62
            new \Http\HttplugBundle\HttplugBundle(),
63
64
            //Alpixel SEO
65
            new \Sonata\SeoBundle\SonataSeoBundle(),
66
            new \Presta\SitemapBundle\PrestaSitemapBundle(),
67
            new \Alpixel\Bundle\SEOBundle\SEOBundle(),
68
69
            //ALPIXEL User
70
            new \Alpixel\Bundle\UserBundle\AlpixelUserBundle(),
71
            new \FOS\UserBundle\FOSUserBundle(),
72
73
            //ALPIXEL CMS bundle
74
            new \Alpixel\Bundle\CMSBundle\AlpixelCMSBundle(),
75
76
            //ALPIXEL media bundle
77
            new \Alpixel\Bundle\MediaBundle\AlpixelMediaBundle(),
78
            new \Liip\ImagineBundle\LiipImagineBundle(),
79
80
            new \Alpixel\Bundle\CMSBundle\Tests\Functional\Fixture\TestBundle\TestBundle(),
81
        ];
82
    }
83
84
    public function registerContainerConfiguration(LoaderInterface $loader)
85
    {
86
        $loader->load($this->config);
87
    }
88
89
    public function getCacheDir()
90
    {
91
        return sys_get_temp_dir().'/TestBundle';
92
    }
93
94
    public function serialize()
95
    {
96
        return $this->config;
97
    }
98
99
    public function unserialize($config)
100
    {
101
        $this->__construct($config);
102
    }
103
}
104