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

Commit de367d0

Browse files
committed
Updated adapter
1 parent db5c654 commit de367d0

File tree

4 files changed

+13
-65
lines changed

4 files changed

+13
-65
lines changed

Adapter/PhpcrOdmAdapter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function removeAutoRoute(AutoRouteInterface $autoRoute)
114114
/**
115115
* {@inheritDoc}
116116
*/
117-
public function createAutoRoute($uri, $contentDocument, $autoRouteTag)
117+
public function createAutoRoute(UriContext $uriContext, $contentDocument, $autoRouteTag)
118118
{
119119
$path = $this->baseRoutePath;
120120
$document = $parentDocument = $this->dm->find(null, $path);
@@ -124,7 +124,7 @@ public function createAutoRoute($uri, $contentDocument, $autoRouteTag)
124124
));
125125
}
126126

127-
$segments = preg_split('#/#', $uri, null, PREG_SPLIT_NO_EMPTY);
127+
$segments = preg_split('#/#', $uriContext->getUri(), null, PREG_SPLIT_NO_EMPTY);
128128
$headName = array_pop($segments);
129129
foreach ($segments as $segment) {
130130
$path .= '/' . $segment;
@@ -189,7 +189,7 @@ public function getReferringAutoRoutes($contentDocument)
189189
/**
190190
* {@inheritDoc}
191191
*/
192-
public function findRouteForUri($uri)
192+
public function findRouteForUri($uri, UriContext $uriContext)
193193
{
194194
$path = $this->getPathFromUri($uri);
195195

Tests/Unit/Adapter/PhpcrOdmAdapterTest.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,26 @@
1212

1313
namespace Symfony\Cmf\Component\RoutingAuto\Tests\Unit\Adapter;
1414

15-
use Symfony\Cmf\Component\RoutingAuto\Tests\Unit\BaseTestCase;
1615
use 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');
3532

36-
$this->phpcrSession = $this->prophet->prophesize('PHPCR\SessionInterface');
37-
$this->phpcrRootNode = $this->prophet->prophesize('PHPCR\NodeInterface');
33+
$this->phpcrSession = $this->prophesize('PHPCR\SessionInterface');
34+
$this->phpcrRootNode = $this->prophesize('PHPCR\NodeInterface');
3835
$this->baseRoutePath = '/test';
3936

4037
$this->adapter = new PhpcrOdmAdapter($this->dm->reveal(), $this->baseRoutePath);

Tests/Unit/BaseTestCase.php

Lines changed: 0 additions & 49 deletions
This file was deleted.

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
],
1212
"minimum-stability": "dev",
1313
"require": {
14-
"symfony-cmf/routing-auto": "~1.0",
14+
"symfony-cmf/routing-auto": "dev-sulu_changes",
1515
"symfony-cmf/routing-bundle": "~1.2",
1616
"symfony-cmf/core-bundle": "~1.2",
1717
"aferrandini/urlizer": "1.0.*",
@@ -21,10 +21,10 @@
2121
"require-dev": {
2222
"symfony-cmf/testing": "~1.1",
2323
"symfony/yaml": "~2.1",
24-
"phpspec/prophecy": "~1.1.2",
2524
"matthiasnoback/symfony-dependency-injection-test": "0.*",
2625
"matthiasnoback/symfony-config-test": "0.*",
27-
"doctrine/phpcr-odm": "~1.2"
26+
"doctrine/phpcr-odm": "~1.2",
27+
"phpunit/phpunit": "~4.5"
2828
},
2929
"suggest": {
3030
"doctrine/phpcr-odm": "To enable support for the PHPCR ODM documents",

0 commit comments

Comments
 (0)