1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the distributed-configuration-bundle package |
5
|
|
|
* |
6
|
|
|
* Copyright (c) 2016 Guillaume Cavana |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* Feel free to edit as you please, and have fun. |
12
|
|
|
* |
13
|
|
|
* @author Guillaume Cavana <[email protected]> |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
namespace Maikuro\DistributedConfigurationBundle\Tests; |
17
|
|
|
|
18
|
|
|
use Maikuro\DistributedConfigurationBundle\DependencyInjection\Configuration; |
19
|
|
|
use Symfony\Component\Config\Definition\Processor; |
20
|
|
|
|
21
|
|
|
class ConfigurationTest extends \PHPUnit_Framework_TestCase |
22
|
|
|
{ |
23
|
|
|
public function testInvalidStoreValue() |
24
|
|
|
{ |
25
|
|
|
$configs = ['gundan_distributed_configuration' => ['store' => ['type' => 'wrong_store']]]; |
26
|
|
|
|
27
|
|
|
$processor = new Processor(); |
28
|
|
|
$configuration = new Configuration(); |
29
|
|
|
|
30
|
|
|
$this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException'); |
|
|
|
|
31
|
|
|
|
32
|
|
|
$config = $processor->processConfiguration($configuration, $configs); |
|
|
|
|
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function testMultipleStoreConfiguration() |
36
|
|
|
{ |
37
|
|
|
$configs = |
38
|
|
|
[ |
39
|
|
|
'gundan_distributed_configuration' => [ |
40
|
|
|
'store' => [ |
41
|
|
|
'predis' => ['client_id' => 'redis.client_id', 'scheme' => 'http'], |
42
|
|
|
], |
43
|
|
|
], |
44
|
|
|
]; |
45
|
|
|
|
46
|
|
|
$processor = new Processor(); |
47
|
|
|
$configuration = new Configuration(); |
48
|
|
|
|
49
|
|
|
$config = $processor->processConfiguration($configuration, $configs); |
50
|
|
|
|
51
|
|
|
$this->assertEquals($config['store']['type'], 'predis'); |
52
|
|
|
$this->assertEquals($config['store']['predis']['client_id'], 'redis.client_id'); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.