mirror of
https://github.com/filp/whoops.git
synced 2026-09-04 06:32:25 +00:00
Fix failing PrettyPageHandler tests
This commit is contained in:
@@ -316,11 +316,11 @@ class PrettyPageHandler extends Handler
|
||||
*/
|
||||
public function getResourcesPath()
|
||||
{
|
||||
trigger_error(__METHOD__ . " is deprecated by PrettyPageHandler::getResourcePaths", E_DEPRECATED);
|
||||
trigger_error(__METHOD__ . " is deprecated by PrettyPageHandler::getResourcePaths", E_USER_NOTICE);
|
||||
|
||||
$allPaths = $this->getResourcePaths();
|
||||
|
||||
// Compat: return only the first path:
|
||||
// Compat: return only the first path
|
||||
return reset($allPaths) ?: null;
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ class PrettyPageHandler extends Handler
|
||||
*/
|
||||
public function setResourcesPath($resourcesPath)
|
||||
{
|
||||
trigger_error(__METHOD__ . " is deprecated by PrettyPageHandler::addResourcePath", E_DEPRECATED);
|
||||
trigger_error(__METHOD__ . " is deprecated by PrettyPageHandler::addResourcePath", E_USER_NOTICE);
|
||||
$this->addResourcePath($resourcesPath);
|
||||
}
|
||||
|
||||
|
||||
@@ -59,26 +59,29 @@ class PrettyPageHandlerTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Whoops\Handler\PrettyPageHandler::setResourcesPath
|
||||
* @covers Whoops\Handler\PrettyPageHandler::getResourcesPath
|
||||
* @covers Whoops\Handler\PrettyPageHandler::addResourcePath
|
||||
* @covers Whoops\Handler\PrettyPageHandler::getResourcePaths
|
||||
*/
|
||||
public function testGetSetResourcesPath()
|
||||
public function testGetSetResourcePaths()
|
||||
{
|
||||
$path = __DIR__; // guaranteed to be valid!
|
||||
$handler = $this->getHandler();
|
||||
|
||||
$handler->setResourcesPath($path);
|
||||
$this->assertEquals($path, $handler->getResourcesPath());
|
||||
$handler->addResourcePath($path);
|
||||
$allPaths = $handler->getResourcePaths();
|
||||
|
||||
$this->assertCount(2, $allPaths);
|
||||
$this->assertEquals($allPaths[1], $path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Whoops\Handler\PrettyPageHandler::setResourcesPath
|
||||
* @covers Whoops\Handler\PrettyPageHandler::addResourcePath
|
||||
* @expectedException InvalidArgumentException
|
||||
*/
|
||||
public function testSetInvalidResourcesPath()
|
||||
{
|
||||
$path = __DIR__ . '/ZIMBABWE'; // guaranteed to be invalid!
|
||||
$this->getHandler()->setResourcesPath($path);
|
||||
$this->getHandler()->addResourcePath($path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user