replace Exception on InitializationException
This commit is contained in:
2
cache/Cacher.php
vendored
2
cache/Cacher.php
vendored
@ -27,7 +27,7 @@ class Cacher
|
|||||||
}
|
}
|
||||||
$cache = new $cacher($config);
|
$cache = new $cacher($config);
|
||||||
if (!$cache instanceof Cache) {
|
if (!$cache instanceof Cache) {
|
||||||
throw new Exception('Cache driver "' . $cacher . '" must extends Cache');
|
throw new InitializationException('Cache driver "' . $cacher . '" must extends Cache');
|
||||||
}
|
}
|
||||||
self::$caches[$cacher] = $cache;
|
self::$caches[$cacher] = $cache;
|
||||||
}
|
}
|
||||||
|
2
cache/MemcacheCache.php
vendored
2
cache/MemcacheCache.php
vendored
@ -40,7 +40,7 @@ class MemcacheCache extends Cache
|
|||||||
foreach ($config as $c) {
|
foreach ($config as $c) {
|
||||||
foreach ($required as $option) {
|
foreach ($required as $option) {
|
||||||
if (!isset($c[$option])) {
|
if (!isset($c[$option])) {
|
||||||
throw new Exception('Configuration must have a "' . $option . '".');
|
throw new InitializationException('Configuration must have a "' . $option . '".');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->connection->addServer($c['hostname'], $c['port']);
|
$this->connection->addServer($c['hostname'], $c['port']);
|
||||||
|
3
tests/cache/CacherTest.php
vendored
3
tests/cache/CacherTest.php
vendored
@ -15,6 +15,7 @@ require_once dirname(__FILE__) . '/../../cache/Cache.php';
|
|||||||
require_once dirname(__FILE__) . '/../../cache/Cacher.php';
|
require_once dirname(__FILE__) . '/../../cache/Cacher.php';
|
||||||
require_once dirname(__FILE__) . '/../../Registry.php';
|
require_once dirname(__FILE__) . '/../../Registry.php';
|
||||||
require_once dirname(__FILE__) . '/../../Config.php';
|
require_once dirname(__FILE__) . '/../../Config.php';
|
||||||
|
require_once dirname(__FILE__) . '/../../exception/InitializationException.php';
|
||||||
|
|
||||||
class CacherTest extends PHPUnit_Framework_TestCase
|
class CacherTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@ -27,7 +28,7 @@ class CacherTest extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Exception
|
* @expectedException InitializationException
|
||||||
* @expectedExcepptionMessage Cache driver
|
* @expectedExcepptionMessage Cache driver
|
||||||
*/
|
*/
|
||||||
public function testNotExtendsCache()
|
public function testNotExtendsCache()
|
||||||
|
3
tests/cache/MemcacheCacheTest.php
vendored
3
tests/cache/MemcacheCacheTest.php
vendored
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
require_once dirname(__FILE__) . '/../../cache/Cache.php';
|
require_once dirname(__FILE__) . '/../../cache/Cache.php';
|
||||||
require_once dirname(__FILE__) . '/../../cache/MemcacheCache.php';
|
require_once dirname(__FILE__) . '/../../cache/MemcacheCache.php';
|
||||||
|
require_once dirname(__FILE__) . '/../../exception/InitializationException.php';
|
||||||
|
|
||||||
class MemcacheCacheTest extends PHPUnit_Framework_TestCase
|
class MemcacheCacheTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@ -36,7 +37,7 @@ class MemcacheCacheTest extends PHPUnit_Framework_TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Exception
|
* @expectedException InitializationException
|
||||||
* @expectedExceptionMessage Configuration must have a
|
* @expectedExceptionMessage Configuration must have a
|
||||||
* @TODO: MemcacheCache::__construct - empty config array passes with no host params
|
* @TODO: MemcacheCache::__construct - empty config array passes with no host params
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user