Skip to content

Commit

Permalink
Test NotFoundException
Browse files Browse the repository at this point in the history
  • Loading branch information
g105b committed Aug 17, 2014
1 parent a880f1e commit fa6e701
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions test/Unit/Dispatcher/PageDispatcher.test.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function testGetPathFromUri($uri) {
}

if(is_dir($filePath)) {
file_put_contents($filePath . "/index.test", "dummy data");
file_put_contents($filePath . "/index.html", "dummy data");
$uri .= "index";
}
else {
Expand Down Expand Up @@ -132,7 +132,7 @@ public function testGetPathFixesUri($uri) {

if(is_dir($filePath)) {
$index = \Gt\Test\Helper::randomiseCase("index");
file_put_contents($filePath . "/$index.test", "dummy data");
file_put_contents($filePath . "/$index.html", "dummy data");
$uri .= "index";
}
else {
Expand All @@ -147,6 +147,12 @@ public function testGetPathFixesUri($uri) {
}
}

public function testGetPathThrowsException() {
$this->setExpectedException("\Gt\Response\NotFoundException");
$uri = "/does-not-exist";
$path = $this->dispatcher->getPath($uri, $fixedUri);
}

/**
* @dataProvider data_uris
*/
Expand All @@ -163,7 +169,7 @@ public function testLoadSourceFromPath($uri) {
}

if(is_dir($filePath)) {
file_put_contents($filePath . "/index.test", "dummy data");
file_put_contents($filePath . "/index.html", "dummy data");
$uri .= "index";
}
else {
Expand Down Expand Up @@ -193,14 +199,14 @@ public function testLoadSourceFromPathWithHeaderFooter($uri) {
}

if(is_dir($filePath)) {
file_put_contents($filePath . "/_header.test", "header data");
file_put_contents($filePath . "/_footer.test", "footer data");
file_put_contents($filePath . "/index.test", "dummy data");
file_put_contents($filePath . "/_header.html", "header data");
file_put_contents($filePath . "/_footer.html", "footer data");
file_put_contents($filePath . "/index.html", "dummy data");
$uri .= "index";
}
else {
file_put_contents(dirname($filePath) . "/_header.test", "header data");
file_put_contents(dirname($filePath) . "/_footer.test", "footer data");
file_put_contents(dirname($filePath) . "/_header.html", "header data");
file_put_contents(dirname($filePath) . "/_footer.html", "footer data");
file_put_contents($filePath, "dummy data");
}

Expand Down Expand Up @@ -262,7 +268,7 @@ public function testDispatcherProcessFixesUri($uri) {

if(is_dir($filePath)) {
$index = \Gt\Test\Helper::randomiseCase("index");
file_put_contents($filePath . "/$index.test", "dummy data ($uri)");
file_put_contents($filePath . "/$index.html", "dummy data ($uri)");
$uri .= "index";
}
else {
Expand Down

0 comments on commit fa6e701

Please sign in to comment.