Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit 0e92ae6

Browse files
committed
Added test for Configuration
1 parent 1354264 commit 0e92ae6

File tree

1 file changed

+143
-0
lines changed

1 file changed

+143
-0
lines changed
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
<?php
2+
3+
namespace Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Unit\DependencyInjection;
4+
5+
use Matthias\SymfonyConfigTest\PhpUnit\AbstractConfigurationTestCase;
6+
use Symfony\Cmf\Bundle\RoutingAutoBundle\DependencyInjection\Configuration;
7+
8+
class ConfigurationTest extends AbstractConfigurationTestCase
9+
{
10+
protected $inputConfig;
11+
12+
public function setUp()
13+
{
14+
$this->inputConfig = array(
15+
'auto_route_mapping' => array(
16+
'Acme\BasicCmsBundle\Document\Page' => array(
17+
'content_path' => array(
18+
'pages' => array(
19+
'provider' => array(
20+
'name' => 'specified',
21+
'path' => '/cms/routes/page',
22+
),
23+
'exists_action' => array(
24+
'strategy' => 'use',
25+
),
26+
'not_exists_action' => array(
27+
'strategy' => 'create',
28+
),
29+
),
30+
),
31+
'content_name' => array(
32+
"provider" => array(
33+
"name" => "content_method",
34+
"method" => "getTitle",
35+
),
36+
"exists_action" => array(
37+
"strategy" => "auto_increment",
38+
"pattern" => "-%d",
39+
),
40+
"not_exists_action" => array(
41+
"strategy" => "create",
42+
),
43+
),
44+
),
45+
),
46+
);
47+
}
48+
49+
protected function getConfiguration()
50+
{
51+
return new Configuration();
52+
}
53+
54+
public function testYamlConfig()
55+
{
56+
$this->assertProcessedConfigurationEquals(
57+
array(
58+
$this->inputConfig,
59+
),
60+
$this->inputConfig
61+
);
62+
}
63+
64+
public function testXmlConfig()
65+
{
66+
$this->assertProcessedConfigurationEquals(
67+
array(
68+
array(
69+
"auto-route-mapping" => array(
70+
array(
71+
"class" => "Acme\BasicCmsBundle\Document\Page",
72+
"content-path" => array(
73+
"pages" => array(
74+
"provider" => array(
75+
"option" => array(
76+
array(
77+
"name" => "name",
78+
"value" => "specified",
79+
),
80+
array(
81+
"name" => "path",
82+
"value" => "/cms/routes/page",
83+
),
84+
),
85+
),
86+
"exists-action" => array(
87+
"option" => array(
88+
array(
89+
"name" => "strategy",
90+
"value" => "use",
91+
)
92+
),
93+
),
94+
"not-exists-action" => array(
95+
"option" => array(
96+
"name" => "strategy",
97+
"value" => "create",
98+
),
99+
),
100+
),
101+
),
102+
"content-name" => array(
103+
"provider" => array(
104+
"option" => array(
105+
array(
106+
"name" => "name",
107+
"value" => "content_method",
108+
),
109+
array(
110+
"name" => "method",
111+
"value" => "getTitle",
112+
),
113+
),
114+
),
115+
"exists-action" => array(
116+
"option" => array(
117+
array(
118+
"name" => "strategy",
119+
"value" => "auto_increment",
120+
),
121+
array(
122+
"name" => "pattern",
123+
"value" => "-%d",
124+
),
125+
),
126+
),
127+
"not-exists-action" => array(
128+
"option" => array(
129+
array(
130+
"name" => "strategy",
131+
"value" => "create",
132+
),
133+
),
134+
),
135+
),
136+
),
137+
),
138+
),
139+
),
140+
$this->inputConfig
141+
);
142+
}
143+
}

0 commit comments

Comments
 (0)