Skip to content

Commit

Permalink
fix escaping in reverse routes
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Green committed Nov 14, 2014
1 parent 1c357d7 commit 396d133
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Phroute/RouteParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ private function staticParts($route, $nextOffset)
{
if($staticPart)
{
$staticPart = $this->quote($staticPart);
$quotedPart = $this->quote($staticPart);

$this->parts[$this->partsCounter] = $staticPart;
$this->parts[$this->partsCounter] = $quotedPart;

$this->reverseParts[$this->partsCounter] = array(
'variable' => false,
Expand Down
10 changes: 10 additions & 0 deletions test/Dispatcher/DispatcherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,16 @@ public function testOptionalReverseRoute()
$this->assertEquals('products/store/1', $r->route('products', array(1)));
}

public function testReverseRouteWithDashes()
{
$r = $this->router();

$r->any( array('product-catalogue/store/{store:i}?', 'products'), array(__NAMESPACE__.'\\Test','route'));

$this->assertEquals('product-catalogue/store', $r->route('products'));
$this->assertEquals('product-catalogue/store/1', $r->route('products', array(1)));
}

/**
* @expectedException \Phroute\Exception\BadRouteException
* @expectedExceptionMessage Expecting route variable 'store'
Expand Down

0 comments on commit 396d133

Please sign in to comment.