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

Commit 394908e

Browse files
committed
Merge pull request #59 from WouterJ/issue_13
Removed feature string -> path feature
2 parents 3f34e06 + d755cd0 commit 394908e

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

AutoRoute/PathProvider/ContentDateTimeProvider.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,17 @@ public function providePath(RouteStack $routeStack)
5454
throw new \RuntimeException(sprintf('Method %s:%s must return an instance of DateTime.'));
5555
}
5656

57-
$string = $date->format($this->dateFormat);
58-
$pathElements = $this->normalizePathElements($string);
57+
$dateString = $date->format($this->dateFormat);
58+
$pathElements = $this->normalizePathElements($dateString);
5959

6060
$routeStack->addPathElements($pathElements);
6161
}
62+
63+
/**
64+
* {@inheritDoc}
65+
*/
66+
public function normalizePathElements($elements)
67+
{
68+
return parent::normalizePathElements(explode('/', $elements));
69+
}
6270
}

AutoRoute/PathProvider/ContentMethodProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ protected function normalizePathElements($pathElements)
8383
throw new \RuntimeException('Path must not be absolute.');
8484
}
8585

86-
$pathElements = explode('/', $pathElements);
86+
$pathElements = array($pathElements);
8787
}
8888

8989
if (!is_array($pathElements)) {

Tests/Unit/AutoRoute/PathProvider/ContentMethodProviderTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ public function testProvideMethodNoSlugify()
9797
public function testProvideMethodWithString()
9898
{
9999
$this->setupTest();
100+
$this->routeStack->expects($this->once())
101+
->method('addPathElements')
102+
->with(array('this/is/a/path'));
100103

101104
$this->provider->init(array('method' => 'getStringSlug'));
102105
$this->provider->providePath($this->routeStack);

0 commit comments

Comments
 (0)