Failed Conditions
Pull Request — master (#790)
by Guilherme
05:12
created

VagrantParametersTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 31
rs 10
c 0
b 0
f 0
wmc 5
1
<?php
2
/**
3
 * This file is part of the login-cidadao project or it's bundles.
4
 *
5
 * (c) Guilherme Donato <guilhermednt on github>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace LoginCidadao\CoreBundle\Tests;
12
13
use PHPUnit\Framework\TestCase;
14
use Symfony\Component\Yaml\Yaml;
15
16
/**
17
 * Class VagrantParametersTest
18
 * @package LoginCidadao\CoreBundle\Tests
19
 */
20
class VagrantParametersTest extends TestCase
21
{
22
    private $dist;
23
    private $vagrant;
24
25
    protected function setUp()
26
    {
27
        $rootDir = realpath(__DIR__.'/../../../../app');
28
        $distPath = implode(DIRECTORY_SEPARATOR, [$rootDir, 'config', 'parameters.yml.dist']);
29
        $vagrantPath = implode(DIRECTORY_SEPARATOR, [$rootDir, 'config', 'parameters.yml.vagrant']);
30
31
        if (file_exists($distPath) && file_exists($vagrantPath)) {
32
            $this->dist = Yaml::parse(file_get_contents($distPath));
33
            $this->vagrant = Yaml::parse(file_get_contents($vagrantPath));
34
        } else {
35
            $this->fail("Config files nor found!");
36
        }
37
    }
38
39
    public function testMissingParameters()
40
    {
41
        foreach ($this->dist['parameters'] as $param => $value) {
42
            $this->assertArrayHasKey($param, $this->vagrant['parameters']);
43
        }
44
    }
45
46
    public function testUnecessaryParameters()
47
    {
48
        foreach ($this->vagrant['parameters'] as $param => $value) {
49
            $this->assertArrayHasKey($param, $this->dist['parameters']);
50
        }
51
    }
52
}
53