Completed
Push — master ( 9ec196...c21c38 )
by Alex
11:51
created

DependencyInjection/OrbitaleCmsExtensionTest.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
* This file is part of the OrbitaleCmsBundle package.
5
*
6
* (c) Alexandre Rock Ancelet <[email protected]>
7
*
8
* For the full copyright and license information, please view the LICENSE
9
* file that was distributed with this source code.
10
*/
11
12
namespace Orbitale\Bundle\CmsBundle\Tests\DependencyInjection;
13
14
use Orbitale\Bundle\CmsBundle\Tests\Fixtures\App\Stub\OrbitaleCmsExtensionStub;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\Yaml\Yaml;
17
18
class OrbitaleCmsExtensionTest extends \PHPUnit_Framework_TestCase
19
{
20
    /**
21
     * @dataProvider provideConfiguration
22
     *
23
     * @param $config
24
     * @param $expected
25
     */
26 View Code Duplication
    public function testConfiguration($config, $expected)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
27
    {
28
        $builder = new ContainerBuilder();
29
30
        $ext = new OrbitaleCmsExtensionStub(true);
31
32
        $ext->load($config, $builder);
33
34
        $this->assertEquals($expected['orbitale_cms'], $builder->getParameter('orbitale_cms.config'));
35
    }
36
37
    /**
38
     * @dataProvider provideConfiguration
39
     *
40
     * @param $config
41
     * @param $expected
42
     */
43 View Code Duplication
    public function testConfigurationSymfony2($config, $expected)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
44
    {
45
        $builder = new ContainerBuilder();
46
47
        $ext = new OrbitaleCmsExtensionStub(false);
48
49
        $ext->load($config, $builder);
50
51
        $this->assertEquals($expected['orbitale_cms'], $builder->getParameter('orbitale_cms.config'));
52
    }
53
54
    public function provideConfiguration()
55
    {
56
        $dir = __DIR__.'/../Fixtures/App/extension_test/';
57
58
        $configFiles = glob($dir.'config_*.yml');
59
        $resultFiles = glob($dir.'result_*.yml');
60
61
        sort($configFiles);
62
        sort($resultFiles);
63
64
        $tests = array();
65
66
        foreach ($configFiles as $k => $file) {
67
            $tests[] = array(
68
                Yaml::parse(file_get_contents($file)), Yaml::parse(file_get_contents($resultFiles[$k])),
69
            );
70
        }
71
72
        return $tests;
73
    }
74
}
75