Laravel 5.6 updates
Travis config update Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
@@ -83,6 +83,45 @@ class XmlFileLoaderTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function testLoadLocalized()
|
||||
{
|
||||
$loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures')));
|
||||
$routeCollection = $loader->load('localized.xml');
|
||||
$routes = $routeCollection->all();
|
||||
|
||||
$this->assertCount(2, $routes, 'Two routes are loaded');
|
||||
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
||||
|
||||
$this->assertEquals('/route', $routeCollection->get('localized.fr')->getPath());
|
||||
$this->assertEquals('/path', $routeCollection->get('localized.en')->getPath());
|
||||
}
|
||||
|
||||
public function testLocalizedImports()
|
||||
{
|
||||
$loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/localized')));
|
||||
$routeCollection = $loader->load('importer-with-locale.xml');
|
||||
$routes = $routeCollection->all();
|
||||
|
||||
$this->assertCount(2, $routes, 'Two routes are loaded');
|
||||
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
||||
|
||||
$this->assertEquals('/le-prefix/le-suffix', $routeCollection->get('imported.fr')->getPath());
|
||||
$this->assertEquals('/the-prefix/suffix', $routeCollection->get('imported.en')->getPath());
|
||||
}
|
||||
|
||||
public function testLocalizedImportsOfNotLocalizedRoutes()
|
||||
{
|
||||
$loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/localized')));
|
||||
$routeCollection = $loader->load('importer-with-locale-imports-non-localized-route.xml');
|
||||
$routes = $routeCollection->all();
|
||||
|
||||
$this->assertCount(2, $routes, 'Two routes are loaded');
|
||||
$this->assertContainsOnly('Symfony\Component\Routing\Route', $routes);
|
||||
|
||||
$this->assertEquals('/le-prefix/suffix', $routeCollection->get('imported.fr')->getPath());
|
||||
$this->assertEquals('/the-prefix/suffix', $routeCollection->get('imported.en')->getPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @dataProvider getPathsToInvalidFiles
|
||||
@@ -382,4 +421,24 @@ class XmlFileLoaderTest extends TestCase
|
||||
$route = $routeCollection->get('baz_route');
|
||||
$this->assertSame('AppBundle:Baz:view', $route->getDefault('_controller'));
|
||||
}
|
||||
|
||||
public function testImportRouteWithNamePrefix()
|
||||
{
|
||||
$loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/import_with_name_prefix')));
|
||||
$routeCollection = $loader->load('routing.xml');
|
||||
|
||||
$this->assertNotNull($routeCollection->get('app_blog'));
|
||||
$this->assertEquals('/blog', $routeCollection->get('app_blog')->getPath());
|
||||
$this->assertNotNull($routeCollection->get('api_app_blog'));
|
||||
$this->assertEquals('/api/blog', $routeCollection->get('api_app_blog')->getPath());
|
||||
}
|
||||
|
||||
public function testImportRouteWithNoTrailingSlash()
|
||||
{
|
||||
$loader = new XmlFileLoader(new FileLocator(array(__DIR__.'/../Fixtures/import_with_no_trailing_slash')));
|
||||
$routeCollection = $loader->load('routing.xml');
|
||||
|
||||
$this->assertEquals('/slash/', $routeCollection->get('a_app_homepage')->getPath());
|
||||
$this->assertEquals('/no-slash', $routeCollection->get('b_app_homepage')->getPath());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user