1212
1313namespace Symfony \Cmf \Component \RoutingAuto \Tests \Unit \Adapter ;
1414
15- use Symfony \Cmf \Component \RoutingAuto \Tests \Unit \BaseTestCase ;
1615use Symfony \Cmf \Bundle \RoutingAutoBundle \Adapter \PhpcrOdmAdapter ;
1716
18- class PhpcrOdmAdapterTest extends BaseTestCase
17+ class PhpcrOdmAdapterTest extends \PHPUnit_Framework_TestCase
1918{
2019 protected $ dm ;
2120 protected $ baseRoutePath ;
2221
2322 public function setUp ()
2423 {
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 ' );
3027 $ this ->contentDocument = new \stdClass ;
3128 $ this ->contentDocument2 = new \stdClass ;
3229 $ this ->baseNode = new \stdClass ;
3330 $ 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 ' );
3533
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 ' );
3836 $ this ->baseRoutePath = '/test ' ;
3937
4038 $ this ->adapter = new PhpcrOdmAdapter ($ this ->dm ->reveal (), $ this ->baseRoutePath );
@@ -117,7 +115,9 @@ public function testCreateAutoRoute($path, $expectedParentPath, $expectedName, $
117115 ->willReturn (null );
118116 }
119117
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 ' );
121121 $ this ->assertNotNull ($ res );
122122 $ this ->assertInstanceOf ('Symfony\Cmf\Bundle\RoutingAutoBundle\Model\AutoRoute ' , $ res );
123123 $ this ->assertEquals ($ expectedName , $ res ->getName ());
@@ -134,7 +134,8 @@ public function testCreateAutoRouteNonExistingBasePath()
134134 {
135135 $ this ->dm ->getPhpcrSession ()->willReturn ($ this ->phpcrSession );
136136 $ 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 ' );
138139 }
139140
140141
@@ -179,7 +180,7 @@ public function testFindRouteForUri()
179180
180181 $ this ->dm ->find (null , $ this ->baseRoutePath . $ uri )->willReturn ($ expectedRoutes );
181182
182- $ res = $ this ->adapter ->findRouteForUri ($ uri );
183+ $ res = $ this ->adapter ->findRouteForUri ($ uri, $ this -> uriContext -> reveal () );
183184 $ this ->assertSame ($ expectedRoutes , $ res );
184185 }
185186}
0 commit comments