|
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\APIBundle\Tests\DependencyInjection; |
|
12
|
|
|
|
|
13
|
|
|
use LoginCidadao\APIBundle\DependencyInjection\Configuration; |
|
14
|
|
|
use Symfony\Component\Config\Definition\Processor; |
|
15
|
|
|
|
|
16
|
|
|
class ConfigurationTest extends \PHPUnit_Framework_TestCase |
|
17
|
|
|
{ |
|
18
|
|
|
public static function getSampleConfig() |
|
19
|
|
|
{ |
|
20
|
|
|
return [ |
|
21
|
|
|
'versions' => [ |
|
22
|
|
|
'1' => [ |
|
23
|
|
|
'0' => [0, 1, 2], |
|
24
|
|
|
], |
|
25
|
|
|
'2' => [ |
|
26
|
|
|
'0' => [0, 2], |
|
27
|
|
|
'1' => [0, 1, 2, 3], |
|
28
|
|
|
], |
|
29
|
|
|
], |
|
30
|
|
|
]; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
public function testGetConfigTreeBuilder() |
|
34
|
|
|
{ |
|
35
|
|
|
$configuration = new Configuration(); |
|
36
|
|
|
$this->assertInstanceOf( |
|
37
|
|
|
'Symfony\Component\Config\Definition\Builder\TreeBuilder', |
|
38
|
|
|
$configuration->getConfigTreeBuilder() |
|
39
|
|
|
); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
public function testEmptyConfig() |
|
43
|
|
|
{ |
|
44
|
|
|
$this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException'); |
|
45
|
|
|
$processor = new Processor(); |
|
46
|
|
|
$processor->processConfiguration(new Configuration(), []); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function testIncompleteConfig() |
|
50
|
|
|
{ |
|
51
|
|
|
$this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException'); |
|
52
|
|
|
$processor = new Processor(); |
|
53
|
|
|
$processor->processConfiguration(new Configuration(), [ |
|
54
|
|
|
[ |
|
55
|
|
|
'versions' => [ |
|
56
|
|
|
'1' => [], |
|
57
|
|
|
], |
|
58
|
|
|
], |
|
59
|
|
|
]); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
public function testSampleConfig() |
|
63
|
|
|
{ |
|
64
|
|
|
$processor = new Processor(); |
|
65
|
|
|
$processor->processConfiguration(new Configuration(), [static::getSampleConfig()]); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|