Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 007c678

Browse files
committed
added tests
1 parent b03cd3b commit 007c678

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

test/Container/ApplicationConfigInjectionDelegatorTest.php

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,49 @@ public function testInjectRoutesFromConfigWillSkipSpecsThatOmitMiddleware()
391391
$this->assertEquals([], $app->getRoutes());
392392
}
393393

394+
public function testInjectRoutesFromConfigSetRouteNameViaArrayKey()
395+
{
396+
$config = [
397+
'routes' => [
398+
'home' => [
399+
'path' => '/',
400+
'middleware' => new TestAsset\InteropMiddleware(),
401+
],
402+
],
403+
];
404+
$this->container->has('config')->willReturn(false);
405+
$app = $this->createApplication();
406+
407+
ApplicationConfigInjectionDelegator::injectRoutesFromConfig($app, $config);
408+
409+
$routes = $app->getRoutes();
410+
411+
$route = array_shift($routes);
412+
$this->assertEquals('home', $route->getName());
413+
}
414+
415+
public function testInjectRoutesFromConfigRouteSpecNameOverrideArrayKeyName()
416+
{
417+
$config = [
418+
'routes' => [
419+
'home' => [
420+
'name' => 'homepage',
421+
'path' => '/',
422+
'middleware' => new TestAsset\InteropMiddleware(),
423+
],
424+
],
425+
];
426+
$this->container->has('config')->willReturn(false);
427+
$app = $this->createApplication();
428+
429+
ApplicationConfigInjectionDelegator::injectRoutesFromConfig($app, $config);
430+
431+
$routes = $app->getRoutes();
432+
433+
$route = array_shift($routes);
434+
$this->assertEquals('homepage', $route->getName());
435+
}
436+
394437
public function testInjectPipelineFromConfigRaisesExceptionForSpecsOmittingMiddlewareKey()
395438
{
396439
$config = [

0 commit comments

Comments
 (0)