-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathXmlFileLoaderTest.php
More file actions
80 lines (63 loc) · 2.17 KB
/
XmlFileLoaderTest.php
File metadata and controls
80 lines (63 loc) · 2.17 KB
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
<?php
namespace BeSimple\I18nRoutingBundle\Tests\Routing\Loader;
use BeSimple\I18nRoutingBundle\Routing\Loader\XmlFileLoader;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\Routing\Route;
/**
* @author Francis Besset <francis.besset@gmail.com>
*/
class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase
{
public function testBasicI18nRoute()
{
$routes = $this->load('basic_i18n_route.xml')->all();
$this->assertEquals(3, count($routes));
$this->assertEquals(
array(
'homepage_locale.be-simple-i18n.en' => new Route('/en/', array(
'_locale' => 'en',
'_controller' => 'TestBundle:Frontend:homepageLocale'
)),
'homepage_locale.be-simple-i18n.de' => new Route('/de/', array(
'_locale' => 'de',
'_controller' => 'TestBundle:Frontend:homepageLocale'
)),
'homepage_locale.be-simple-i18n.fr' => new Route('/fr/', array(
'_locale' => 'fr',
'_controller' => 'TestBundle:Frontend:homepageLocale'
)),
),
$routes
);
}
public function testBasicRoutes()
{
$routes = $this->load('basic_routes.xml')->all();
$this->assertEquals(4, count($routes));
}
public function testFullLocale()
{
$routes = $this->load('full_locale.xml')->all();
$this->assertEquals(3, count($routes));
}
public function testImport()
{
$routes = $this->load('import.xml')->all();
$this->assertEquals(7, count($routes));
}
public function testImportPrefix()
{
$routes = $this->load('import_prefix.xml')->all();
$this->assertEquals(7, count($routes));
}
public function testImportPrefixLocalized()
{
$routes = $this->load('import_prefix_locale.xml')->all();
$this->assertEquals(6, count($routes));
}
private function load($file)
{
$loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../../Fixtures')));
return $loader->load($file, 'be_simple_i18n');
}
}