Skip to content

Commit

Permalink
removed baseUri appending to route pattern ControllerActionRoutes (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mararok authored Apr 26, 2018
1 parent 45ef018 commit 097d637
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public function delete(string $pattern, string $action): ControllerActionRoute
public function addRoute(ControllerActionRoute $r): self
{
$r->controller($this->getController());
$r->pattern($this->getBaseUri() . $r->getPattern());
$this->routes[] = $r;
return $this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ protected function setUp()
*/
public function testCreatedRoute(string $httpMethod)
{
$expectedPattern = "p";
$expectedAction = "a";
$route = $this->routes->$httpMethod($expectedPattern, $expectedAction);
$this->assertRoute(strtoupper($httpMethod), $this->routes->getBaseUri() . $expectedPattern, $expectedAction, $route);
$pattern = "p";
$action = "a";
$route = $this->routes->$httpMethod($pattern, $action);
$this->assertRoute(strtoupper($httpMethod), $pattern, $action, $route);
$this->assertRouteController('c', $route);
$this->assertSame([$route], $this->routes->getRoutes());
}
Expand All @@ -53,10 +53,10 @@ public function httpMethodsProvider()

public function testAddRoute()
{
$r = ControllerActionRoute::route()->pattern('/p');
$r = ControllerActionRoute::route()->pattern('p');
$this->routes->addRoute($r);
$this->assertRouteController('c', $r);
$this->assertRoutePattern('base/p', $r);
$this->assertRoutePattern('p', $r);
$this->assertSame([$r], $this->routes->getRoutes());
}

Expand Down

0 comments on commit 097d637

Please sign in to comment.