12
12
13
13
namespace Symfony \Cmf \Component \RoutingAuto \Tests \Unit \Adapter ;
14
14
15
- use Symfony \Cmf \Component \RoutingAuto \Tests \Unit \BaseTestCase ;
16
15
use Symfony \Cmf \Bundle \RoutingAutoBundle \Adapter \PhpcrOdmAdapter ;
17
16
18
- class PhpcrOdmAdapterTest extends BaseTestCase
17
+ class PhpcrOdmAdapterTest extends \PHPUnit_Framework_TestCase
19
18
{
20
19
protected $ dm ;
21
20
protected $ baseRoutePath ;
22
21
23
22
public function setUp ()
24
23
{
25
- parent ::setUp ();
26
-
27
- $ this ->dm = $ this ->prophet ->prophesize ('Doctrine\ODM\PHPCR\DocumentManager ' );
28
- $ this ->metadataFactory = $ this ->prophet ->prophesize ('Doctrine\ODM\PHPCR\Mapping\ClassMetadataFactory ' );
29
- $ this ->metadata = $ this ->prophet ->prophesize ('Doctrine\ODM\PHPCR\Mapping\ClassMetadata ' );
24
+ $ this ->dm = $ this ->prophesize ('Doctrine\ODM\PHPCR\DocumentManager ' );
25
+ $ this ->metadataFactory = $ this ->prophesize ('Doctrine\ODM\PHPCR\Mapping\ClassMetadataFactory ' );
26
+ $ this ->metadata = $ this ->prophesize ('Doctrine\ODM\PHPCR\Mapping\ClassMetadata ' );
30
27
$ this ->contentDocument = new \stdClass ;
31
28
$ this ->contentDocument2 = new \stdClass ;
32
29
$ this ->baseNode = new \stdClass ;
33
30
$ this ->parentRoute = new \stdClass ;
34
- $ this ->route = $ this ->prophet ->prophesize ('Symfony\Cmf\Component\RoutingAuto\Model\AutoRouteInterface ' );
31
+ $ this ->route = $ this ->prophesize ('Symfony\Cmf\Component\RoutingAuto\Model\AutoRouteInterface ' );
32
+ $ this ->uriContext = $ this ->prophesize ('Symfony\Cmf\Component\RoutingAuto\UriContext ' );
35
33
36
- $ this ->phpcrSession = $ this ->prophet -> prophesize ('PHPCR\SessionInterface ' );
37
- $ this ->phpcrRootNode = $ this ->prophet -> prophesize ('PHPCR\NodeInterface ' );
34
+ $ this ->phpcrSession = $ this ->prophesize ('PHPCR\SessionInterface ' );
35
+ $ this ->phpcrRootNode = $ this ->prophesize ('PHPCR\NodeInterface ' );
38
36
$ this ->baseRoutePath = '/test ' ;
39
37
40
38
$ this ->adapter = new PhpcrOdmAdapter ($ this ->dm ->reveal (), $ this ->baseRoutePath );
@@ -117,7 +115,9 @@ public function testCreateAutoRoute($path, $expectedParentPath, $expectedName, $
117
115
->willReturn (null );
118
116
}
119
117
120
- $ res = $ this ->adapter ->createAutoRoute ($ path , $ this ->contentDocument , 'fr ' );
118
+ $ this ->uriContext ->getUri ()->willReturn ($ path );
119
+
120
+ $ res = $ this ->adapter ->createAutoRoute ($ this ->uriContext ->reveal (), $ this ->contentDocument , 'fr ' );
121
121
$ this ->assertNotNull ($ res );
122
122
$ this ->assertInstanceOf ('Symfony\Cmf\Bundle\RoutingAutoBundle\Model\AutoRoute ' , $ res );
123
123
$ this ->assertEquals ($ expectedName , $ res ->getName ());
@@ -134,7 +134,8 @@ public function testCreateAutoRouteNonExistingBasePath()
134
134
{
135
135
$ this ->dm ->getPhpcrSession ()->willReturn ($ this ->phpcrSession );
136
136
$ this ->dm ->find (null , $ this ->baseRoutePath )->willReturn (null );
137
- $ this ->adapter ->createAutoRoute ('/foo ' , $ this ->contentDocument , 'fr ' );
137
+ $ this ->uriContext ->getUri ()->willReturn ('/asdasd ' );
138
+ $ this ->adapter ->createAutoRoute ($ this ->uriContext ->reveal (), $ this ->contentDocument , 'fr ' );
138
139
}
139
140
140
141
@@ -179,7 +180,7 @@ public function testFindRouteForUri()
179
180
180
181
$ this ->dm ->find (null , $ this ->baseRoutePath . $ uri )->willReturn ($ expectedRoutes );
181
182
182
- $ res = $ this ->adapter ->findRouteForUri ($ uri );
183
+ $ res = $ this ->adapter ->findRouteForUri ($ uri, $ this -> uriContext -> reveal () );
183
184
$ this ->assertSame ($ expectedRoutes , $ res );
184
185
}
185
186
}
0 commit comments