forked from GeniusesOfSymfony/WebSocketBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConfigurationTest.php
83 lines (73 loc) · 2.01 KB
/
ConfigurationTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
namespace Gos\Bundle\WebSocketBundle\Tests;
use Gos\Bundle\WebSocketBundle\DependencyInjection\Configuration;
use Symfony\Component\Config\Definition\Processor;
/**
* Class ConfigurationTest
*/
final class ConfigurationTest extends \PHPUnit_Framework_TestCase
{
public function testContextConfigurationIsOptional()
{
/* Config:
*
* server:
* host: "127.0.0.1"
* port: "8080"
*/
$configs = array(
array(
'server' => array(
'host' => "127.0.0.1",
'port' => "8080",
),
),
);
$config = $this->process($configs);
$this->assertEquals('127.0.0.1', $config['server']['host']);
$this->assertEquals('8080', $config['server']['port']);
}
/**
* Processes an array of configurations and returns a compiled version.
*
* @param array $configs An array of raw configurations
*
* @return array A normalized array
*/
protected function process($configs)
{
$processor = new Processor();
return $processor->processConfiguration(new Configuration(), $configs);
}
public function testTokenSeparatorIsSet()
{
/*
* Config:
*
* server:
* host: "127.0.0.1"
* port: "8080"
* router:
* context:
* tokenSeparator: "-"
*/
$configs = array(
array(
'server' => array(
'host' => "127.0.0.1",
'port' => "8080",
'router' => array(
'context' => array(
"tokenSeparator" => "/",
),
),
),
),
);
$config = $this->process($configs);
$this->assertEquals(
'/',
$config['server']['router']['context']['tokenSeparator']
);
}
}