replacement @expectedException to setExpectedException
This commit is contained in:
@ -17,7 +17,6 @@ require_once dirname(__FILE__) . '/../../exception/GeneralException.php';
|
||||
|
||||
class DbDriverTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
private $driver;
|
||||
|
||||
public function setUp()
|
||||
@ -29,15 +28,18 @@ class DbDriverTest extends PHPUnit_Framework_TestCase
|
||||
public function testConstruct()
|
||||
{
|
||||
$conf = array('hostname' => 'localhost', 'database' => 'db', 'username' => 'test', 'password' => '1234');
|
||||
$this->driver = $this->getMockForAbstractClass('DbDriver', array($conf));
|
||||
try {
|
||||
$this->driver = $this->getMockForAbstractClass('DbDriver', array($conf));
|
||||
}
|
||||
catch (GeneralException $expected) {
|
||||
$this->fail($expected->getMessage());
|
||||
}
|
||||
$this->assertInstanceOf('DbDriver', $this->driver);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException GeneralException
|
||||
* @expectedExceptionMessage Configuration must have a "username".
|
||||
*/
|
||||
public function testConstructWrongConfig()
|
||||
{
|
||||
$this->setExpectedException('GeneralException', 'Configuration must have a "username"');
|
||||
$conf = array('hostname' => 'localhost', 'database' => 'db');
|
||||
$this->getMockForAbstractClass('DbDriver', array($conf));
|
||||
}
|
||||
@ -130,7 +132,7 @@ class DbDriverTest extends PHPUnit_Framework_TestCase
|
||||
public function testDeleteWithWHEREDbExpr()
|
||||
{
|
||||
$this->setDriverPrepareFunction();
|
||||
|
||||
|
||||
$sql = $this->driver->delete('users', new DbExpr('name=tony'));
|
||||
$this->assertEquals('DELETE FROM `users` WHERE name=tony', $sql);
|
||||
}
|
||||
|
Reference in New Issue
Block a user