Skip to content

Commit

Permalink
Add two more tests for 100% coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
levidurfee committed Aug 11, 2018
1 parent c4d6ac3 commit a146948
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
8 changes: 8 additions & 0 deletions tests/RouterTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,12 @@ public function testDeleteMethod()
$this->assertEquals($routes[0]['method'], 'DELETE');
$this->assertEquals($routes[0]['callable'], 'callable');
}

public function testRouteInfoMethod()
{
$router = new Router;
$router->delete('/', 'callable');
$routeInfo = $router->routeInfo();
$this->assertInternalType('array', $routeInfo);
}
}
14 changes: 13 additions & 1 deletion tests/RoutingTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,19 @@ public function testRouteWithVariables()
$this->assertSame('callable', $routeInfo->handler());
$this->assertInternalType('array', $routeInfo->vars());
$this->assertSame(['id' => '1'], $routeInfo->vars());
var_dump($routeInfo->vars());
}

public function testFilterUriMethod()
{
$router = new Router;
$router->get('/user/{id}', 'callable');

$request = new ServerRequest([], [], '/user/1?wee=true', 'GET');
$routeInfo = $router->run($request);

$this->assertInstanceOf(ServerRequestInterface::class, $request);
$this->assertSame('callable', $routeInfo->handler());
$this->assertInternalType('array', $routeInfo->vars());
$this->assertSame(['id' => '1'], $routeInfo->vars());
}
}

0 comments on commit a146948

Please sign in to comment.