Moving setExpectedException
This commit is contained in:
@ -39,8 +39,10 @@ class DbDriverTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
public function testConstructWrongConfig()
|
||||
{
|
||||
$this->setExpectedException('GeneralException', 'Configuration must have a "username"');
|
||||
$conf = array('hostname' => 'localhost', 'database' => 'db');
|
||||
|
||||
$this->setExpectedException('GeneralException', 'Configuration must have a "username"');
|
||||
|
||||
$this->getMockForAbstractClass('DbDriver', array($conf));
|
||||
}
|
||||
|
||||
|
@ -69,8 +69,8 @@ class DbStatementTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
public function testBindParamExceptionWrongObject()
|
||||
{
|
||||
$this->setExpectedException('GeneralException', 'Objects excepts DbExpr not allowed.');
|
||||
$val = $this->getMock('NotDbExpr');
|
||||
$this->setExpectedException('GeneralException', 'Objects excepts DbExpr not allowed.');
|
||||
$this->stmt->bindParam('paa', $val);
|
||||
}
|
||||
|
||||
|
@ -49,9 +49,8 @@ class DbTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
public function testConnectWithWrongDriver()
|
||||
{
|
||||
$this->setExpectedException('InitializationException', 'Database driver must extends DbDriver');
|
||||
$this->getMock('NotDbDriver', array(), array(), 'NoDbDriverMock');
|
||||
$this->setExpectedException('InitializationException', 'Database driver must extends DbDriver');
|
||||
$driver = Db::connect('nodb', array('hostname' => 'localhost', 'driver' => 'NoDbDriverMock'));
|
||||
}
|
||||
|
||||
}
|
@ -85,10 +85,11 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
|
||||
$this->setExpectedException('GeneralException', 'Unknown database \'nodb\'');
|
||||
$this->conf['database'] = 'nodb';
|
||||
$driver = new MySQLiDriver($this->conf);
|
||||
|
||||
$this->setExpectedException('GeneralException', 'Unknown database \'nodb\'');
|
||||
|
||||
$this->assertNull('mysqli', $driver->getConnection());
|
||||
}
|
||||
|
||||
|
@ -70,8 +70,8 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
$this->setExpectedException('GeneralException', 'ERROR');
|
||||
$this->setDriverGetConnectionWrongResultMethod();
|
||||
$this->setExpectedException('GeneralException', 'ERROR');
|
||||
$this->stmt->execute(array('place' => 'place_val', 'new' => 'new_val'));
|
||||
}
|
||||
|
||||
@ -174,9 +174,11 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase
|
||||
if (!defined('DEBUG')) {
|
||||
define('DEBUG', false);
|
||||
}
|
||||
$this->setExpectedException('GeneralException');
|
||||
$this->setDriverGetConnectionMethod();
|
||||
$this->stmt->execute(array('place' => 'place_val', 'new' => 'new_val'));
|
||||
|
||||
$this->setExpectedException('GeneralException');
|
||||
|
||||
$this->stmt->fetch(324);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user