|
|
@ -25,6 +25,8 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase |
|
|
|
|
|
|
|
private $conf = array(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected function getConnection() |
|
|
|
{ |
|
|
|
if ($this->conn === null) { |
|
|
@ -49,7 +51,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase |
|
|
|
$this->setPreserveGlobalState(false); |
|
|
|
return parent::run($result); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @group MySQL |
|
|
|
*/ |
|
|
|
public function testDriver() |
|
|
|
{ |
|
|
|
if (!defined('DEBUG')) { |
|
|
@ -68,7 +72,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase |
|
|
|
$this->assertSame(1, $driver->insert('table', array('id' => 3, 'user' => 'tony', 'content' => 'some test content', 'created' => '2011-11-07 11:35:20'))); |
|
|
|
$this->assertSame(3, $this->getConnection()->getRowCount('table')); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @group MySQL |
|
|
|
*/ |
|
|
|
public function testGetConnection() |
|
|
|
{ |
|
|
|
if (!defined('DEBUG')) { |
|
|
@ -79,7 +85,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase |
|
|
|
$this->assertInstanceOf('mysqli', $driver->getConnection()); |
|
|
|
$this->assertTrue($driver->isConnected()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @group MySQL |
|
|
|
*/ |
|
|
|
public function testGetConnectionWrongConfig() |
|
|
|
{ |
|
|
|
if (!defined('DEBUG')) { |
|
|
@ -92,7 +100,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase |
|
|
|
|
|
|
|
$this->assertNull('mysqli', $driver->getConnection()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @group MySQL |
|
|
|
*/ |
|
|
|
public function testDisconnect() |
|
|
|
{ |
|
|
|
if (!defined('DEBUG')) { |
|
|
@ -109,7 +119,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase |
|
|
|
$driver->disconnect(); |
|
|
|
$this->assertAttributeEquals(null, 'connection', $driver); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @group MySQL |
|
|
|
*/ |
|
|
|
public function testInsert() |
|
|
|
{ |
|
|
|
if (!defined('DEBUG')) { |
|
|
@ -130,6 +142,7 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase |
|
|
|
|
|
|
|
/** |
|
|
|
* @TODO: DbDriver::getInsertId($table = null, $key = null) - params not used |
|
|
|
* @group MySQL |
|
|
|
*/ |
|
|
|
public function testGetInsertId() |
|
|
|
{ |
|
|
@ -142,7 +155,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase |
|
|
|
$this->assertSame(1, $driver->insert('table', array('id' => 3, 'user' => 'tony', 'content' => 'some test content', 'created' => '2011-11-07 11:35:20'))); |
|
|
|
$this->assertSame(3, $driver->getInsertId()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @group MySQL |
|
|
|
*/ |
|
|
|
public function testTransaction() |
|
|
|
{ |
|
|
|
if (!defined('DEBUG')) { |
|
|
@ -173,7 +188,9 @@ class MySQLiDriverTest extends PHPUnit_Extensions_Database_TestCase |
|
|
|
->getTable("table"); |
|
|
|
$this->assertTablesEqual($expectedTable, $queryTable); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @group MySQL |
|
|
|
*/ |
|
|
|
public function testRollback() |
|
|
|
{ |
|
|
|
if (!defined('DEBUG')) { |
|
|
|