|
|
@ -13,9 +13,9 @@ |
|
|
|
require_once dirname(__FILE__) . '/../../Registry.php'; |
|
|
|
require_once dirname(__FILE__) . '/../../Config.php'; |
|
|
|
require_once dirname(__FILE__) . '/../../redis/RedisManager.php'; |
|
|
|
require_once dirname(__FILE__) . '/../../exception/InitializationException.php'; |
|
|
|
require_once dirname(__FILE__) . '/../../exception/GeneralException.php'; |
|
|
|
|
|
|
|
|
|
|
|
class RedisManagerTest extends PHPUnit_Framework_TestCase |
|
|
|
{ |
|
|
|
|
|
|
@ -46,12 +46,13 @@ class RedisManagerTest extends PHPUnit_Framework_TestCase |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @expectedException GeneralException |
|
|
|
* @expectedExceptionMessage Trying to get property of non-object |
|
|
|
* @TODO: line 34: $config = Config::get('Redis')->$name; - check for Redis config existence |
|
|
|
* @TODO: line 34: $config = Config::get('Redis')->$name; - check for Redis config existence. Agafonov: 'check added' |
|
|
|
*/ |
|
|
|
public function testConnectNoAnyConfig() |
|
|
|
{ |
|
|
|
//$this->setExpectedException('GeneralException');
|
|
|
|
$this->setExpectedException('GeneralException'); |
|
|
|
RedisManager::connect(); |
|
|
|
} |
|
|
|
|
|
|
@ -61,6 +62,7 @@ class RedisManagerTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testConnectWrongPersistantConfig() |
|
|
|
{ |
|
|
|
$this->setExpectedException('GeneralException'); |
|
|
|
Config::set('Redis', array('new' => 'some')); |
|
|
|
RedisManager::connect('new'); |
|
|
|
} |
|
|
@ -71,6 +73,7 @@ class RedisManagerTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testConnectDefaultConfig() |
|
|
|
{ |
|
|
|
$this->setExpectedException('GeneralException'); |
|
|
|
Config::set('Redis', array('default' => 'some')); |
|
|
|
RedisManager::connect(); |
|
|
|
} |
|
|
@ -81,6 +84,7 @@ class RedisManagerTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testConnectFailedConnection() |
|
|
|
{ |
|
|
|
$this->setExpectedException('GeneralException'); |
|
|
|
Config::set('Redis', array('new' => array('host' => 'error', 'port' => 2023, 'database' => 'some'))); |
|
|
|
RedisManager::connect('new'); |
|
|
|
} |
|
|
@ -91,20 +95,21 @@ class RedisManagerTest extends PHPUnit_Framework_TestCase |
|
|
|
*/ |
|
|
|
public function testConnectEstablishedConnectionNoDb() |
|
|
|
{ |
|
|
|
$this->setExpectedException('GeneralException'); |
|
|
|
Config::set('Redis', array('new' => array('host' => true, 'port' => 2023, 'database' => 'some'))); |
|
|
|
RedisManager::connect('new'); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function testConnectionGood() |
|
|
|
{ |
|
|
|
// $this->setExpectedException('GeneralException');
|
|
|
|
Config::set('Redis', array('new' => array('host' => true, 'port' => 2023, 'database' => true))); |
|
|
|
$redis = RedisManager::connect('new'); |
|
|
|
$this->assertInstanceOf('RedisMock', $redis); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @runInSeparateProcess |
|
|
|
*/ |
|
|
|
|
|
|
|
public function testConnectWithDebug() |
|
|
|
{ |
|
|
|
if (!defined('DEBUG')) { |
|
|
|