Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit e09e182

Browse files
committed
Factory fixed
1 parent 7fd6fd3 commit e09e182

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

AutoRoute/Factory.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
namespace Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute;
44

55
use Symfony\Component\DependencyInjection\ContainerInterface;
6+
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteStack\Builder;
7+
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteStack\BuilderUnitChain;
8+
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteStack\BuilderUnit;
69

710
/**
811
* @author Daniel Leech <[email protected]>
@@ -24,7 +27,7 @@ class Factory
2427
protected $container;
2528
protected $builder;
2629

27-
public function __construct(ContainerInterface $container, RouteStackBuilder $builder)
30+
public function __construct(ContainerInterface $container, Builder $builder)
2831
{
2932
$this->container = $container;
3033
$this->builder = $builder;
@@ -44,7 +47,7 @@ public function registerAlias($type, $alias, $id)
4447
$this->serviceIds[$type][$alias] = $id;
4548
}
4649

47-
public function getRouteStackBuilderChain($classFqn)
50+
public function getRouteStackBuilderUnitChain($classFqn)
4851
{
4952
if (!isset($this->routeStackChains[$classFqn])) {
5053
$this->routeStackChains[$classFqn] = $this->generateRouteStackChain($classFqn);
@@ -69,23 +72,23 @@ protected function generateRouteStackChain($classFqn)
6972
{
7073
$mapping = $this->getMapping($classFqn);
7174

72-
$routeStackChain = new RouteStackBuilderUnitChain($this->builder);
75+
$routeStackChain = new BuilderUnitChain($this->builder);
7376

7477
foreach ($mapping['content_path'] as $builderName => $builderConfig) {
7578
$builderUnit = $this->generateBuilderUnit($builderConfig);
76-
$routeStackChain->addRouteStackBuilderUnit($builderName, $builderUnit);
79+
$routeStackChain->addBuilderUnit($builderName, $builderUnit);
7780
}
7881

7982
return $routeStackChain;
8083
}
8184

8285
protected function generateBuilderUnit($config)
8386
{
84-
$pathProvider = $this->getBuilderService($builderConfig, 'provider', 'name');
85-
$existsAction = $this->getBuilderService($builderConfig, 'exists_action', 'strategy');
86-
$notExistsAction = $this->getBuilderService($builderConfig, 'not_exists_action', 'strategy');
87+
$pathProvider = $this->getBuilderService($config, 'provider', 'name');
88+
$existsAction = $this->getBuilderService($config, 'exists_action', 'strategy');
89+
$notExistsAction = $this->getBuilderService($config, 'not_exists_action', 'strategy');
8790

88-
$builderUnit = new RouteStackBuilderUnit(
91+
$builderUnit = new BuilderUnit(
8992
$pathProvider,
9093
$existsAction,
9194
$notExistsAction

Tests/AutoRoute/FactoryTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase
1010
public function setUp()
1111
{
1212
$this->builder = $this->getMockBuilder(
13-
'Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteStackBuilder'
13+
'Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteStack\Builder'
1414
)->disableOriginalConstructor()->getMock();
1515

1616
$this->container = $this->getMock(
@@ -44,7 +44,7 @@ public function setUp()
4444
*/
4545
public function testClassNotMappedException()
4646
{
47-
$this->bucf->getChain('FooBar');
47+
$this->bucf->getRouteStackBuilderUnitChain('FooBar');
4848
}
4949

5050
public function provideTestGetChain()
@@ -106,6 +106,6 @@ public function testGetChain($config, $assertOptions)
106106
}
107107

108108
$this->bucf->registerMapping('FooBar/Class', $config);
109-
$this->bucf->getChain('FooBar/Class');
109+
$this->bucf->getRouteStackBuilderUnitChain('FooBar/Class');
110110
}
111111
}

0 commit comments

Comments
 (0)