Fix failing PrettyPageHandler tests

This commit is contained in:
filp
2013-06-24 23:22:06 +01:00
parent 088f4b556a
commit e6add5bd5e
2 changed files with 13 additions and 10 deletions
+3 -3
View File
@@ -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);
}
+10 -7
View File
@@ -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);
}
/**