Skip to content

Commit

Permalink
fixed broken cubrid tests
Browse files Browse the repository at this point in the history
fixed expected quoting
  • Loading branch information
cebe committed Sep 14, 2013
1 parent 30907b6 commit d374093
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/unit/framework/db/cubrid/CubridCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,13 @@ public function testBindParamValue()
$command->bindValue(':name', 'user5');
$this->assertEquals('[email protected]', $command->queryScalar());
}

public function testAutoQuoting()
{
$db = $this->getConnection(false);

$sql = 'SELECT [[id]], [[t.name]] FROM {{tbl_customer}} t';
$command = $db->createCommand($sql);
$this->assertEquals('SELECT "id", "t"."name" FROM "tbl_customer" t', $command->sql);
}
}
23 changes: 23 additions & 0 deletions tests/unit/framework/db/cubrid/CubridConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,27 @@ public function testQuoteValue()
$this->assertEquals("'string'", $connection->quoteValue('string'));
$this->assertEquals("'It''s interesting'", $connection->quoteValue("It's interesting"));
}

public function testQuoteTableName()
{
$connection = $this->getConnection(false);
$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"'));
$this->assertEquals('{{table}}', $connection->quoteTableName('{{table}}'));
$this->assertEquals('(table)', $connection->quoteTableName('(table)'));
}

public function testQuoteColumnName()
{
$connection = $this->getConnection(false);
$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"'));
$this->assertEquals('[[column]]', $connection->quoteColumnName('[[column]]'));
$this->assertEquals('{{column}}', $connection->quoteColumnName('{{column}}'));
$this->assertEquals('(column)', $connection->quoteColumnName('(column)'));
}
}

0 comments on commit d374093

Please sign in to comment.