replacement @expectedException to setExpectedException

This commit is contained in:
Vyacheslav Agafonov
2011-12-01 17:35:13 +04:00
parent c214995796
commit 66857702b6
7 changed files with 22 additions and 46 deletions

View File

@ -19,21 +19,14 @@ require_once dirname(__FILE__) . '/../../exception/InitializationException.php';
class DbTest extends PHPUnit_Framework_TestCase
{
/**
* @expectedExceptionMessage Trying to get property of non-object
*/
public function testConnectNoParams()
{
$this->setExpectedException('InitializationException');
$this->setExpectedException('InitializationException', 'Trying to get property of non-object');
Db::connect();
}
/**
* @expectedExceptionMessage Connection parameters must be an array
*/
public function testConnectConfigNotArray()
{
$this->setExpectedException('InitializationException');
$this->setExpectedException('InitializationException', 'Connection parameters must be an array');
Db::connect('name', 'config');
}
@ -53,13 +46,11 @@ class DbTest extends PHPUnit_Framework_TestCase
$driver = Db::connect('mysql', $conf);
$this->assertInstanceOf('DbDriver', $driver);
}
/**
* @expectedExceptionMessage Database driver must extends DbDriver
*/
public function testConnectWithWrongDriver()
{
$this->setExpectedException('InitializationException', 'Database driver must extends DbDriver');
$this->getMock('NotDbDriver', array(), array(), 'NoDbDriverMock');
$this->setExpectedException('InitializationException');
$driver = Db::connect('nodb', array('hostname' => 'localhost', 'driver' => 'NoDbDriverMock'));
}