Merge pull request #182 from GrahamCampbell/fix

Improved Resources
This commit is contained in:
Denis
2014-03-21 23:52:03 +02:00
2 changed files with 8 additions and 8 deletions
+7 -7
View File
@@ -373,7 +373,7 @@ class PrettyPageHandler extends Handler
);
}
$this->searchPaths[] = $path;
array_unshift($this->searchPaths, $path);
}
/**
@@ -414,10 +414,10 @@ class PrettyPageHandler extends Handler
return $this->resourceCache[$resource];
}
// Search through available search paths, in reverse order,
// until we find the resource we're after:
for($i = count($this->searchPaths) - 1; $i >= 0; $i--) {
$fullPath = $this->searchPaths[$i] . "/$resource";
// Search through available search paths, until we find the
// resource we're after:
foreach($this->searchPaths as $path) {
$fullPath = $path . "/$resource";
if(is_file($fullPath)) {
// Cache the result:
@@ -442,8 +442,8 @@ class PrettyPageHandler extends Handler
{
$allPaths = $this->getResourcePaths();
// Compat: return only the first path
return reset($allPaths) ?: null;
// Compat: return only the first path added
return end($allPaths) ?: null;
}
/**
@@ -76,7 +76,7 @@ class PrettyPageHandlerTest extends TestCase
$allPaths = $handler->getResourcePaths();
$this->assertCount(2, $allPaths);
$this->assertEquals($allPaths[1], $path);
$this->assertEquals($allPaths[0], $path);
}
/**