Skip to content

Commit 94a8148

Browse files
committed
Added tests
1 parent 7f94546 commit 94a8148

File tree

5 files changed

+86
-0
lines changed

5 files changed

+86
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<config xmlns="http://cmf.symfony.com/schema/dic/routing">
2+
</config>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<config xmlns="http://cmf.symfony.com/schema/dic/routing">
2+
3+
<dynamic route-collection-limit="12"
4+
default-controller="acme_main.controller:mainAction"
5+
uri-filter-regexp="/foo/"
6+
route-provider-service-id="acme_service"
7+
content-repository-service-id="acme_service"
8+
>
9+
<persistence>
10+
<orm
11+
manager-name="default"
12+
/>
13+
</persistence>
14+
15+
<route-filter-by-id id="foo">bar</route-filter-by-id>
16+
</dynamic>
17+
</config>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<config xmlns="http://cmf.symfony.com/schema/dic/routing">
2+
3+
<dynamic>
4+
<persistence>
5+
<phpcr
6+
manager-name="default"
7+
/>
8+
</persistence>
9+
</dynamic>
10+
</config>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<config xmlns="http://cmf.symfony.com/schema/dic/routing">
2+
3+
<dynamic>
4+
<persistence>
5+
<phpcr />
6+
<orm />
7+
</persistence>
8+
</dynamic>
9+
</config>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony CMF package.
5+
*
6+
* (c) 2011-2013 Symfony CMF
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
13+
namespace Symfony\Cmf\Bundle\RoutingBundle\Tests\Unit\DependencyInjection;
14+
15+
use Symfony\Cmf\Component\Testing\Unit\XmlSchemaTestCase;
16+
17+
class XmlSchemaTest extends XmlSchemaTestCase
18+
{
19+
protected $fixturesPath;
20+
protected $schemaPath;
21+
22+
public function setUp()
23+
{
24+
$this->fixturesPath = __DIR__.'/../../Resources/Fixtures/config/';
25+
$this->schemaPath = __DIR__.'/../../../Resources/config/schema/routing-1.0.xsd';
26+
}
27+
28+
public function testSchema()
29+
{
30+
$fixturesPath = $this->fixturesPath;
31+
$xmlFiles = array_map(function ($file) use ($fixturesPath) {
32+
return $fixturesPath.$file;
33+
}, array(
34+
'config.xml',
35+
'config1.xml',
36+
'config2.xml',
37+
'config3.xml',
38+
));
39+
40+
$this->assertSchemaAcceptsXml($xmlFiles, $this->schemaPath);
41+
}
42+
43+
public function testSchemaInvalidesTwoPersistenceLayers()
44+
{
45+
$this->assertSchemaRefusesXml($this->fixturesPath.'config_invalid1.xml', $this->schemaPath);
46+
}
47+
}
48+

0 commit comments

Comments
 (0)