replace Exception on GeneralException

This commit is contained in:
Vyacheslav Agafonov
2011-11-25 19:50:41 +04:00
parent d4705b1c89
commit 443655064c
11 changed files with 26 additions and 20 deletions

View File

@ -12,6 +12,7 @@
require_once dirname(__FILE__) . '/../Registry.php';
require_once dirname(__FILE__) . '/../Config.php';
require_once dirname(__FILE__) . '/../exception/GeneralException.php';
class ConfigTest extends PHPUnit_Framework_TestCase
{
@ -34,7 +35,7 @@ class ConfigTest extends PHPUnit_Framework_TestCase
}
/**
* @expectedException Exception
* @expectedException GeneralException
* @expectedExceptionMessage Configuration variable
*/
public function testArrayAsParam()

View File

@ -13,6 +13,7 @@
require_once dirname(__FILE__) . '/../../model/DbExpr.php';
require_once dirname(__FILE__) . '/../../model/Db.php';
require_once dirname(__FILE__) . '/../../model/DbDriver.php';
require_once dirname(__FILE__) . '/../../exception/GeneralException.php';
class DbDriverTest extends PHPUnit_Framework_TestCase
{
@ -32,7 +33,7 @@ class DbDriverTest extends PHPUnit_Framework_TestCase
}
/**
* @expectedException Exception
* @expectedException GeneralException
* @expectedExceptionMessage Configuration must have a "username".
*/
public function testConstructWrongConfig()

View File

@ -13,6 +13,7 @@
require_once dirname(__FILE__) . '/../../model/Db.php';
require_once dirname(__FILE__) . '/../../model/DbDriver.php';
require_once dirname(__FILE__) . '/../../model/DbStatement.php';
require_once dirname(__FILE__) . '/../../exception/GeneralException.php';
class DbStatementTest extends PHPUnit_Framework_TestCase
{
@ -56,7 +57,7 @@ class DbStatementTest extends PHPUnit_Framework_TestCase
}
/**
* @expectedException Exception
* @expectedException GeneralException
* @expectedExceptionMessage Placeholder must be an array or string
* @TODO: change Exception Message 'Placeholder must be an array or string' - no arrays available
*/
@ -67,7 +68,7 @@ class DbStatementTest extends PHPUnit_Framework_TestCase
}
/**
* @expectedException Exception
* @expectedException GeneralException
* @expectedExceptionMessage Objects excepts DbExpr not allowed.
*/
public function testBindParamExceptionWrongObject()

View File

@ -14,12 +14,13 @@ require_once dirname(__FILE__) . '/../../Registry.php';
require_once dirname(__FILE__) . '/../../Config.php';
require_once dirname(__FILE__) . '/../../model/DbDriver.php';
require_once dirname(__FILE__) . '/../../model/Db.php';
require_once dirname(__FILE__) . '/../../exception/GeneralException.php';
class DbTest extends PHPUnit_Framework_TestCase
{
/**
* @expectedException Exception
* @expectedException GeneralException
* @expectedExceptionMessage Trying to get property of non-object
*/
public function testConnectNoParams()
@ -27,7 +28,7 @@ class DbTest extends PHPUnit_Framework_TestCase
Db::connect();
}
/**
* @expectedException Exception
* @expectedException GeneralException
* @expectedExceptionMessage Connection parameters must be an array
*/
public function testConnectConfigNotArray()
@ -51,7 +52,7 @@ class DbTest extends PHPUnit_Framework_TestCase
$this->assertInstanceOf('DbDriver', $driver);
}
/**
* @expectedException Exception
* @expectedException GeneralException
* @expectedExceptionMessage Database driver must extends DbDriver
*/
public function testConnectWithWrongDriver()

View File

@ -15,6 +15,7 @@ require_once dirname(__FILE__) . '/../../model/DbStatement.php';
require_once dirname(__FILE__) . '/../../model/MySQLiStatement.php';
require_once dirname(__FILE__) . '/../../model/DbDriver.php';
require_once dirname(__FILE__) . '/../../model/MySQLiDriver.php';
require_once dirname(__FILE__) . '/../../exception/GeneralException.php';
class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase
{
@ -80,7 +81,7 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase
}
/**
* @expectedException Exception
* @expectedException GeneralException
* @expectedExceptionMessage Unknown database
*/
public function testGetConnectionWrongConfig()

View File

@ -16,6 +16,7 @@ require_once dirname(__FILE__) . '/../../model/Db.php';
require_once dirname(__FILE__) . '/../../model/DbDriver.php';
require_once dirname(__FILE__) . '/../../model/DbStatement.php';
require_once dirname(__FILE__) . '/../../model/MySQLiStatement.php';
require_once dirname(__FILE__) . '/../../exception/GeneralException.php';
class MySQLiStatementTest extends PHPUnit_Framework_TestCase
{
@ -63,7 +64,7 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase
/**
* @runInSeparateProcess
* @expectedException Exception
* @expectedException GeneralException
* @expectedExceptionMessage ERROR
*/
public function testDriverExecuteNoResult()
@ -153,22 +154,22 @@ class MySQLiStatementTest extends PHPUnit_Framework_TestCase
/**
* @runInSeparateProcess
* @expectedException Exception
* @TODO: exception just for code coverage - could not mock mysqli properties
*/
public function testNumRows()
{
$this->markTestSkipped();
if (!defined('DEBUG')) {
define('DEBUG', false);
}
$this->setDriverGetConnectionMethod();
$this->stmt->execute(array('place' => 'place_val', 'new' => 'new_val'));
$this->assertNull($this->stmt->numRows());
}
/**
* @expectedException Exception
* @expectedException GeneralException
* @expectedExceptionMessage Invalid fetch mode
* @runInSeparateProcess
*/