Moving setExpectedException

This commit is contained in:
Vyacheslav Agafonov
2011-12-02 12:25:47 +04:00
parent 1f1551aea1
commit 0fda3de8b5
16 changed files with 38 additions and 29 deletions

View File

@ -91,10 +91,9 @@ class RedisDebugTest extends PHPUnit_Framework_TestCase
if (!defined('DEBUG')) {
define('DEBUG', true);
}
$this->setExpectedException('GeneralException', 'call_user_func_array() expects parameter 1 to be a valid callback');
$mock = $this->getMock('Redis', array('connect'));
$redisDebug = new RedisDebug($mock);
$this->setExpectedException('GeneralException');
$this->assertNull($redisDebug->nothing('localhost', 4322));

View File

@ -50,29 +50,29 @@ class RedisManagerTest extends PHPUnit_Framework_TestCase
public function testConnectWrongPersistantConfig()
{
$this->setExpectedException('GeneralException', 'Connection parameters must be an array');
Config::set('Redis', array('new' => 'some'));
$this->setExpectedException('GeneralException', 'Connection parameters must be an array');
RedisManager::connect('new');
}
public function testConnectDefaultConfig()
{
$this->setExpectedException('GeneralException', 'Connection parameters must be an array');
Config::set('Redis', array('default' => 'some'));
$this->setExpectedException('GeneralException', 'Connection parameters must be an array');
RedisManager::connect();
}
public function testConnectFailedConnection()
{
$this->setExpectedException('GeneralException', 'Failed to connect to Redis server at');
Config::set('Redis', array('new' => array('host' => 'error', 'port' => 2023, 'database' => 'some')));
$this->setExpectedException('GeneralException', 'Failed to connect to Redis server at');
RedisManager::connect('new');
}
public function testConnectEstablishedConnectionNoDb()
{
$this->setExpectedException('GeneralException', 'Failed to select Redis database with index');
Config::set('Redis', array('new' => array('host' => true, 'port' => 2023, 'database' => 'some')));
$this->setExpectedException('GeneralException', 'Failed to select Redis database with index');
RedisManager::connect('new');
}