added annotation @runInSeparateProcess and removing annotations @expectedException
This commit is contained in:
@ -13,21 +13,18 @@
|
||||
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
|
||||
{
|
||||
|
||||
private $connections;
|
||||
|
||||
|
||||
public function run(PHPUnit_Framework_TestResult $result = NULL)
|
||||
{
|
||||
$this->setPreserveGlobalState(false);
|
||||
return parent::run($result);
|
||||
}
|
||||
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->getMock('Redis');
|
||||
@ -46,70 +43,52 @@ class RedisManagerTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedExceptionMessage Trying to get property of non-object
|
||||
* @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');
|
||||
$this->setExpectedException('GeneralException', 'Redis config no existence');
|
||||
RedisManager::connect();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expected Exception GeneralException
|
||||
* @expected ExceptionMessage Connection parameters must be an array
|
||||
*/
|
||||
public function testConnectWrongPersistantConfig()
|
||||
{
|
||||
$this->setExpectedException('GeneralException');
|
||||
$this->setExpectedException('GeneralException', 'Connection parameters must be an array');
|
||||
Config::set('Redis', array('new' => 'some'));
|
||||
RedisManager::connect('new');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expected Exception GeneralException
|
||||
* @expected ExceptionMessage Connection parameters must be an array
|
||||
*/
|
||||
public function testConnectDefaultConfig()
|
||||
{
|
||||
$this->setExpectedException('GeneralException');
|
||||
$this->setExpectedException('GeneralException', 'Connection parameters must be an array');
|
||||
Config::set('Redis', array('default' => 'some'));
|
||||
RedisManager::connect();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expected Exception GeneralException
|
||||
* @expected ExceptionMessage Failed to connect to Redis server at
|
||||
*/
|
||||
public function testConnectFailedConnection()
|
||||
{
|
||||
$this->setExpectedException('GeneralException');
|
||||
$this->setExpectedException('GeneralException', 'Failed to connect to Redis server at');
|
||||
Config::set('Redis', array('new' => array('host' => 'error', 'port' => 2023, 'database' => 'some')));
|
||||
RedisManager::connect('new');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expected Exception GeneralException
|
||||
* @expected ExceptionMessage Failed to select Redis database with index
|
||||
*/
|
||||
public function testConnectEstablishedConnectionNoDb()
|
||||
{
|
||||
$this->setExpectedException('GeneralException');
|
||||
$this->setExpectedException('GeneralException', 'Failed to select Redis database with index');
|
||||
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')) {
|
||||
|
Reference in New Issue
Block a user