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

Commit 67c4411

Browse files
committed
Fixed everything so that Functional test works
1 parent c6d1514 commit 67c4411

File tree

13 files changed

+85
-101
lines changed

13 files changed

+85
-101
lines changed

AutoRoute/Factory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class Factory
2222
'provider' => array(),
2323
'exists_action' => array(),
2424
'not_exists_action' => array(),
25+
'route_maker' => array(),
2526
);
2627

2728
protected $container;

AutoRoute/PathExists/AutoIncrementPath.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\BuilderContext;
77
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteStack;
88
use Doctrine\ODM\PHPCR\DocumentManager;
9-
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteMaker;
9+
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteMakerInterface;
1010

1111
/**
1212
* @author Daniel Leech <[email protected]>
@@ -16,7 +16,7 @@ class AutoIncrementPath implements PathActionInterface
1616
protected $dm;
1717
protected $routeMaker;
1818

19-
public function __construct(DocumentManager $dm, RouteMaker $routeMaker)
19+
public function __construct(DocumentManager $dm, RouteMakerInterface $routeMaker)
2020
{
2121
$this->dm = $dm;
2222
$this->routeMaker = $routeMaker;
@@ -38,6 +38,6 @@ public function execute(RouteStack $routeStack)
3838

3939
$routeStack->replaceLastPathElement(basename($newPath));
4040

41-
$this->routeMaker->makeRoutes($routeStack);
41+
$this->routeMaker->make($routeStack);
4242
}
4343
}

AutoRoute/PathNotExists/CreatePath.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\PathActionInterface;
66
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteStack;
7-
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteMaker;
7+
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteMakerInterface;
88

99
/**
1010
* @author Daniel Leech <[email protected]>
@@ -13,7 +13,7 @@ class CreatePath implements PathActionInterface
1313
{
1414
protected $routeMaker;
1515

16-
public function __construct(RouteMaker $routeMaker)
16+
public function __construct(RouteMakerInterface $routeMaker)
1717
{
1818
$this->routeMaker = $routeMaker;
1919
}
@@ -24,6 +24,6 @@ public function init(array $options)
2424

2525
public function execute(RouteStack $routeStack)
2626
{
27-
$this->routeMaker->makeRoutes($routeStack);
27+
$this->routeMaker->make($routeStack);
2828
}
2929
}

DependencyInjection/Compiler/AutoRoutePass.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ public function process(ContainerBuilder $container)
2626

2727

2828
$types = array(
29-
'provider', 'exists_action', 'not_exists_action'
29+
'provider',
30+
'exists_action',
31+
'not_exists_action',
32+
'route_maker'
3033
);
3134

3235
foreach ($types as $type) {
@@ -47,5 +50,3 @@ public function process(ContainerBuilder $container)
4750
}
4851
}
4952
}
50-
51-

DependencyInjection/SymfonyCmfRoutingAutoExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function load(array $configs, ContainerBuilder $container)
2424
$loader->load('path_provider.xml');
2525
$loader->load('exists_action.xml');
2626
$loader->load('not_exists_action.xml');
27+
$loader->load('route_maker.xml');
2728

2829
$config = $processor->processConfiguration($configuration, $configs);
2930
$chainFactoryDef = $container->getDefinition('symfony_cmf_routing_auto.factory');

Resources/config/auto_route.xml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
<parameter key="symfony_cmf_routing_auto.factory_class">Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\Factory</parameter>
1111
<parameter key="symfony_cmf_routing_auto.route_stack_builder_class">Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteStack\Builder</parameter>
1212
<parameter key="symfony_cmf_routing_auto.route_patcher_class">Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RoutePatcher\GenericPatcher</parameter>
13-
<parameter key="symfony_cmf_routing_auto.route_maker_class">Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteMaker</parameter>
14-
<parameter key="symfony_cmf_routing_auto.auto_route_maker_class">Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\AutoRouteMaker</parameter>
1513

1614
</parameters>
1715

@@ -50,14 +48,5 @@
5048
<argument type="service" id="doctrine_phpcr.odm.default_document_manager"/>
5149
</service>
5250

53-
<service id="symfony_cmf_routing_auto.auto_route_maker" class="%symfony_cmf_routing_auto.auto_route_maker_class%">
54-
<argument type="service" id="doctrine_phpcr.odm.default_document_manager"/>
55-
</service>
56-
57-
<service id="symfony_cmf_routing_auto.route_maker" class="%symfony_cmf_routing_auto.route_maker_class%">
58-
<argument type="service" id="symfony_cmf_routing_auto.auto_route_maker"/>
59-
<argument type="service" id="symfony_cmf_routing_auto.route_patcher"/>
60-
</service>
61-
6251
</services>
6352
</container>

Resources/config/exists_action.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
scope="prototype"
2828
>
2929
<argument type="service" id="doctrine_phpcr.odm.default_document_manager"/>
30-
<argument type="service" id="symfony_cmf_routing_auto.route_maker"/>
30+
<argument type="service" id="symfony_cmf_routing_auto.route_maker.default"/>
3131
<tag name="symfony_cmf_routing_auto.exists_action" alias="auto_increment"/>
3232
</service>
3333

Resources/config/not_exists_action.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
class="%symfony_cmf_routing_auto.not_exists_action.create_class%"
2525
scope="prototype"
2626
>
27-
<argument type="service" id="symfony_cmf_routing_auto.route_maker"/>
27+
<argument type="service" id="symfony_cmf_routing_auto.route_maker.default"/>
2828
<tag name="symfony_cmf_routing_auto.not_exists_action" alias="create"/>
2929
</service>
3030

Resources/config/route_maker.xml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<container xmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
5+
6+
<parameters>
7+
8+
<parameter key="symfony_cmf_routing_auto.route_maker.default_class">Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteMaker\DefaultMaker</parameter>
9+
<parameter key="symfony_cmf_routing_auto.route_maker.auto_route_class">Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteMaker\AutoRouteMaker</parameter>
10+
<parameter key="symfony_cmf_routing_auto.route_maker.generic_class">Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteMaker\GenericMaker</parameter>
11+
<parameter key="symfony_cmf_routing_auto.route_maker.route_class">Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteMaker\RouteMaker</parameter>
12+
13+
</parameters>
14+
15+
<services>
16+
17+
<service
18+
id="symfony_cmf_routing_auto.route_maker.default"
19+
class="%symfony_cmf_routing_auto.route_maker.default_class%"
20+
scope="prototype"
21+
>
22+
<argument type="service" id="symfony_cmf_routing_auto.route_maker.auto_route"/>
23+
<argument type="service" id="symfony_cmf_routing_auto.route_maker.generic"/>
24+
<tag name="symfony_cmf_routing_auto.route_maker" alias="default"/>
25+
</service>
26+
27+
<service
28+
id="symfony_cmf_routing_auto.route_maker.auto_route"
29+
class="%symfony_cmf_routing_auto.route_maker.auto_route_class%"
30+
scope="prototype"
31+
>
32+
<argument type="service" id="doctrine_phpcr.odm.default_document_manager"/>
33+
<tag name="symfony_cmf_routing_auto.route_maker" alias="auto_route"/>
34+
</service>
35+
36+
<service
37+
id="symfony_cmf_routing_auto.route_maker.generic"
38+
class="%symfony_cmf_routing_auto.route_maker.generic_class%"
39+
scope="prototype"
40+
>
41+
<argument type="service" id="doctrine_phpcr.odm.default_document_manager"/>
42+
<tag name="symfony_cmf_routing_auto.route_maker" alias="generic"/>
43+
</service>
44+
45+
<service
46+
id="symfony_cmf_routing_auto.route_maker.route"
47+
class="%symfony_cmf_routing_auto.route_maker.route_class%"
48+
scope="prototype"
49+
>
50+
<argument type="service" id="doctrine_phpcr.odm.default_document_manager"/>
51+
<tag name="symfony_cmf_routing_auto.route_maker" alias="route"/>
52+
</service>
53+
54+
</services>
55+
</container>
56+
57+

Tests/AutoRoute/PathExists/AutoIncrementPathTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ class AutoIncrementPathTest extends \PHPUnit_Framework_TestCase
88
{
99
public function setUp()
1010
{
11-
$this->routeMaker = $this->getMockBuilder(
12-
'Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteMaker'
13-
)->disableOriginalConstructor()->getMock();
11+
$this->routeMaker = $this->getMock(
12+
'Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteMakerInterface'
13+
);
1414

1515
$this->dm = $this->getMockBuilder('Doctrine\ODM\PHPCR\DocumentManager')
1616
->disableOriginalConstructor()
@@ -44,7 +44,7 @@ public function testAutoIncrement()
4444
->with('bar-2');
4545

4646
$this->routeMaker->expects($this->once())
47-
->method('makeRoutes')
47+
->method('make')
4848
->with($this->routeStack);
4949

5050
$this->aiPath->execute($this->routeStack);

0 commit comments

Comments
 (0)