Completed
Pull Request — master (#27)
by Benjamin
14:14 queued 11:46
created

AppKernel::getCacheDir()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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 User
65
            new \Alpixel\Bundle\UserBundle\AlpixelUserBundle(),
66
            new \FOS\UserBundle\FOSUserBundle(),
67
68
            //ALPIXEL CMS bundle
69
            new \Alpixel\Bundle\CMSBundle\AlpixelCMSBundle(),
70
71
            //ALPIXEL media bundle
72
            new \Alpixel\Bundle\MediaBundle\AlpixelMediaBundle(),
73
            new \Liip\ImagineBundle\LiipImagineBundle(),
74
75
            new \Alpixel\Bundle\CMSBundle\Tests\Functional\Fixture\TestBundle\TestBundle(),
76
        ];
77
    }
78
79
    public function registerContainerConfiguration(LoaderInterface $loader)
80
    {
81
        $loader->load($this->config);
82
    }
83
84
    public function getCacheDir()
85
    {
86
        return sys_get_temp_dir().'/TestBundle';
87
    }
88
89
    public function serialize()
90
    {
91
        return $this->config;
92
    }
93
94
    public function unserialize($config)
95
    {
96
        $this->__construct($config);
97
    }
98
}
99