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

Commit c6d1514

Browse files
committed
Added Test for DefaultMaker
1 parent 158c40e commit c6d1514

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

AutoRoute/RouteMaker/DefaultMaker.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
<?php
22

3-
namespace Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute;
3+
namespace Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteMaker;
44

55
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteMakerInterface;
6+
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteStack;
7+
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\AutoRouteStack;
68

79
/**
810
* Default route maker class - automatically delegates to an
911
* appropriate maker depending on the context.
1012
*
1113
* @author Daniel Leech <[email protected]>
1214
*/
13-
class RouteMaker implements RouteMakerInterface
15+
class DefaultMaker implements RouteMakerInterface
1416
{
1517
protected $autoRouteMaker;
1618
protected $patcher;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
3+
namespace Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\AutoRoute\DefaultMaker;
4+
5+
use Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteMaker\DefaultMaker;
6+
7+
class DefaultMakerTest extends \PHPUnit_Framework_TestCase
8+
{
9+
public function setUp()
10+
{
11+
$this->autoRouteMaker = $this->getMock(
12+
'Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteMakerInterface'
13+
);
14+
15+
$this->routeMaker = $this->getMock(
16+
'Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteMakerInterface'
17+
);
18+
19+
$this->routeStack = $this->getMockBuilder(
20+
'Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\RouteStack'
21+
)->disableOriginalConstructor()->getMock();
22+
$this->autoRouteStack = $this->getMockBuilder(
23+
'Symfony\Cmf\Bundle\RoutingAutoBundle\AutoRoute\AutoRouteStack'
24+
)->disableOriginalConstructor()->getMock();
25+
26+
$this->defaultMaker = new DefaultMaker(
27+
$this->autoRouteMaker,
28+
$this->routeMaker
29+
);
30+
}
31+
32+
public function testMakeWithAutoRouteStack()
33+
{
34+
$this->autoRouteMaker->expects($this->once())
35+
->method('make')
36+
->with($this->autoRouteStack);
37+
$this->defaultMaker->make($this->autoRouteStack);
38+
}
39+
40+
public function testMakeWithNormalRouteStack()
41+
{
42+
$this->routeMaker->expects($this->once())
43+
->method('make')
44+
->with($this->routeStack);
45+
$this->defaultMaker->make($this->routeStack);
46+
}
47+
}

0 commit comments

Comments
 (0)