|
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
|
|
|
/** |
|
12
|
|
|
* Created by PhpStorm. |
|
13
|
|
|
* User: gdnt |
|
14
|
|
|
* Date: 04/04/17 |
|
15
|
|
|
* Time: 11:41 |
|
16
|
|
|
*/ |
|
17
|
|
|
|
|
18
|
|
|
namespace PROCERGS\SmsServiceBundle\Tests\DependencyInjection; |
|
19
|
|
|
|
|
20
|
|
|
|
|
21
|
|
|
use PHPUnit\Framework\TestCase; |
|
22
|
|
|
use PROCERGS\SmsServiceBundle\DependencyInjection\Configuration; |
|
23
|
|
|
use Symfony\Component\Config\Definition\Processor; |
|
24
|
|
|
|
|
25
|
|
|
class ConfigurationTest extends TestCase |
|
26
|
|
|
{ |
|
27
|
|
|
public static function getConfig() |
|
28
|
|
|
{ |
|
29
|
|
|
return [ |
|
30
|
|
|
'uri' => [ |
|
31
|
|
|
'send' => 'https://some.address/send', |
|
32
|
|
|
'receive' => 'https://some.address/send', |
|
33
|
|
|
'status' => 'https://some.address/send', |
|
34
|
|
|
], |
|
35
|
|
|
'system' => [ |
|
36
|
|
|
'realm' => 'my_realm', |
|
37
|
|
|
'id' => 'SYSTEM', |
|
38
|
|
|
'key' => 'SECRET_KEY', |
|
39
|
|
|
], |
|
40
|
|
|
'send' => true, |
|
41
|
|
|
]; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
public function testGetConfigTreeBuilder() |
|
45
|
|
|
{ |
|
46
|
|
|
$configuration = new Configuration(); |
|
47
|
|
|
$this->assertInstanceOf( |
|
48
|
|
|
'Symfony\Component\Config\Definition\Builder\TreeBuilder', |
|
49
|
|
|
$configuration->getConfigTreeBuilder() |
|
50
|
|
|
); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function testEmptyConfig() |
|
54
|
|
|
{ |
|
55
|
|
|
$this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException'); |
|
56
|
|
|
$processor = new Processor(); |
|
57
|
|
|
$processor->processConfiguration(new Configuration(), []); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
public function testFullConfig() |
|
61
|
|
|
{ |
|
62
|
|
|
$processor = new Processor(); |
|
63
|
|
|
$expected = $this->getConfig(); |
|
64
|
|
|
$config = $processor->processConfiguration(new Configuration(), [$expected]); |
|
65
|
|
|
$this->assertEquals($expected, $config); |
|
66
|
|
|
} |
|
67
|
|
|
} |
|
68
|
|
|
|