|
@@ -60,4 +60,33 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase
|
|
|
$loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
|
|
|
$loader->load('nonvalidkeys.yml');
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @expectedException \InvalidArgumentException
|
|
|
+ */
|
|
|
+ public function testLoadThrowsExceptionWhenIncomplete()
|
|
|
+ {
|
|
|
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
|
|
|
+ $loader->load('incomplete.yml');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testLoadWithPattern()
|
|
|
+ {
|
|
|
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
|
|
|
+ $routeCollection = $loader->load('validpattern.yml');
|
|
|
+ $routes = $routeCollection->all();
|
|
|
+
|
|
|
+ $this->assertEquals(1, count($routes), 'One route is loaded');
|
|
|
+ $this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testLoadWithResource()
|
|
|
+ {
|
|
|
+ $loader = new YamlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
|
|
|
+ $routeCollection = $loader->load('validresource.yml');
|
|
|
+ $routes = $routeCollection->all();
|
|
|
+
|
|
|
+ $this->assertEquals(1, count($routes), 'One route is loaded');
|
|
|
+ $this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
|
|
+ }
|
|
|
}
|