Browse Source

...

tags/2.0.0-beta
Qiang Xue 13 years ago
parent
commit
ab29feea85
  1. 14
      tests/unit/framework/db/dao/ConnectionTest.php

14
tests/unit/framework/db/dao/ConnectionTest.php

@ -8,7 +8,7 @@ class ConnectionTest extends \yiiunit\MysqlTestCase
{ {
function testConstruct() function testConstruct()
{ {
$connection = $this->getConnection(); $connection = $this->getConnection(false);
$params = $this->getParam('mysql'); $params = $this->getParam('mysql');
$this->assertEquals($params['dsn'], $connection->dsn); $this->assertEquals($params['dsn'], $connection->dsn);
@ -18,7 +18,7 @@ class ConnectionTest extends \yiiunit\MysqlTestCase
function testOpenClose() function testOpenClose()
{ {
$connection = $this->getConnection(); $connection = $this->getConnection(false);
$this->assertFalse($connection->active); $this->assertFalse($connection->active);
$this->assertEquals(null, $connection->pdo); $this->assertEquals(null, $connection->pdo);
@ -38,14 +38,14 @@ class ConnectionTest extends \yiiunit\MysqlTestCase
function testGetDriverName() function testGetDriverName()
{ {
$connection = $this->getConnection(); $connection = $this->getConnection(false);
$this->assertEquals('mysql', $connection->driverName); $this->assertEquals('mysql', $connection->driverName);
$this->assertFalse($connection->active); $this->assertFalse($connection->active);
} }
function testQuoteValue() function testQuoteValue()
{ {
$connection = $this->getConnection(); $connection = $this->getConnection(false);
$this->assertEquals(123, $connection->quoteValue(123)); $this->assertEquals(123, $connection->quoteValue(123));
$this->assertEquals("'string'", $connection->quoteValue('string')); $this->assertEquals("'string'", $connection->quoteValue('string'));
$this->assertEquals("'It\'s interesting'", $connection->quoteValue("It's interesting")); $this->assertEquals("'It\'s interesting'", $connection->quoteValue("It's interesting"));
@ -53,7 +53,7 @@ class ConnectionTest extends \yiiunit\MysqlTestCase
function testQuoteTableName() function testQuoteTableName()
{ {
$connection = $this->getConnection(); $connection = $this->getConnection(false);
$this->assertEquals('`table`', $connection->quoteTableName('table')); $this->assertEquals('`table`', $connection->quoteTableName('table'));
$this->assertEquals('`table`', $connection->quoteTableName('`table`')); $this->assertEquals('`table`', $connection->quoteTableName('`table`'));
$this->assertEquals('`schema`.`table`', $connection->quoteTableName('schema.table')); $this->assertEquals('`schema`.`table`', $connection->quoteTableName('schema.table'));
@ -62,7 +62,7 @@ class ConnectionTest extends \yiiunit\MysqlTestCase
function testQuoteColumnName() function testQuoteColumnName()
{ {
$connection = $this->getConnection(); $connection = $this->getConnection(false);
$this->assertEquals('`column`', $connection->quoteColumnName('column')); $this->assertEquals('`column`', $connection->quoteColumnName('column'));
$this->assertEquals('`column`', $connection->quoteColumnName('`column`')); $this->assertEquals('`column`', $connection->quoteColumnName('`column`'));
$this->assertEquals('`table`.`column`', $connection->quoteColumnName('table.column')); $this->assertEquals('`table`.`column`', $connection->quoteColumnName('table.column'));
@ -71,7 +71,7 @@ class ConnectionTest extends \yiiunit\MysqlTestCase
function testGetPdoType() function testGetPdoType()
{ {
$connection = $this->getConnection(); $connection = $this->getConnection(false);
$this->assertEquals(\PDO::PARAM_BOOL, $connection->getPdoType('boolean')); $this->assertEquals(\PDO::PARAM_BOOL, $connection->getPdoType('boolean'));
$this->assertEquals(\PDO::PARAM_INT, $connection->getPdoType('integer')); $this->assertEquals(\PDO::PARAM_INT, $connection->getPdoType('integer'));
$this->assertEquals(\PDO::PARAM_STR, $connection->getPdoType('string')); $this->assertEquals(\PDO::PARAM_STR, $connection->getPdoType('string'));

Loading…
Cancel
Save