Files
yii2/tests/framework/db/oci/OracleCommandTest.php
2015-11-20 16:16:44 +03:00

34 lines
845 B
PHP

<?php
namespace yiiunit\framework\db\oci;
use yii\db\Schema;
use yiiunit\framework\db\CommandTest;
/**
* @group db
* @group oci
*/
class OracleCommandTest extends CommandTest
{
protected $driverName = 'oci';
public function testAutoQuoting()
{
$db = $this->getConnection(false);
$sql = 'SELECT [[id]], [[t.name]] FROM {{customer}} t';
$command = $db->createCommand($sql);
$this->assertEquals('SELECT "id", "t"."name" FROM "customer" t', $command->sql);
}
public function testLastInsertId()
{
$db = $this->getConnection();
$sql = 'INSERT INTO {{profile}}([[description]]) VALUES (\'non duplicate\')';
$command = $db->createCommand($sql);
$command->execute();
$this->assertEquals(3, $db->getSchema()->getLastInsertID('profile_SEQ'));
}
}