diff --git a/src/Phroute/RouteParser.php b/src/Phroute/RouteParser.php index 9ecbe15..7018998 100644 --- a/src/Phroute/RouteParser.php +++ b/src/Phroute/RouteParser.php @@ -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, diff --git a/test/Dispatcher/DispatcherTest.php b/test/Dispatcher/DispatcherTest.php index 1f7d910..0939d68 100644 --- a/test/Dispatcher/DispatcherTest.php +++ b/test/Dispatcher/DispatcherTest.php @@ -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'