You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.7 KiB
57 lines
1.7 KiB
10 years ago
|
<?php
|
||
|
|
||
|
namespace yiiunit\framework\db\oci;
|
||
|
|
||
|
use yii\db\oci\Schema;
|
||
|
|
||
|
/**
|
||
|
* @group db
|
||
|
* @group oci
|
||
|
*/
|
||
8 years ago
|
class QueryBuilderTest extends \yiiunit\framework\db\QueryBuilderTest
|
||
10 years ago
|
{
|
||
|
public $driverName = 'oci';
|
||
|
|
||
|
/**
|
||
|
* this is not used as a dataprovider for testGetColumnType to speed up the test
|
||
|
* when used as dataprovider every single line will cause a reconnect with the database which is not needed here
|
||
|
*/
|
||
|
public function columnTypes()
|
||
|
{
|
||
9 years ago
|
return array_merge(parent::columnTypes(), [
|
||
9 years ago
|
[
|
||
|
Schema::TYPE_BOOLEAN . ' DEFAULT 1 NOT NULL',
|
||
|
$this->boolean()->notNull()->defaultValue(1),
|
||
|
'NUMBER(1) DEFAULT 1 NOT NULL'
|
||
|
],
|
||
9 years ago
|
]);
|
||
10 years ago
|
}
|
||
9 years ago
|
|
||
9 years ago
|
|
||
9 years ago
|
public function testCommentColumn()
|
||
|
{
|
||
|
$qb = $this->getQueryBuilder();
|
||
|
|
||
9 years ago
|
$expected = "COMMENT ON COLUMN [[comment]].[[text]] IS 'This is my column.'";
|
||
9 years ago
|
$sql = $qb->addCommentOnColumn('comment', 'text', 'This is my column.');
|
||
9 years ago
|
$this->assertEquals($this->replaceQuotes($expected), $sql);
|
||
9 years ago
|
|
||
9 years ago
|
$expected = "COMMENT ON COLUMN [[comment]].[[text]] IS ''";
|
||
9 years ago
|
$sql = $qb->dropCommentFromColumn('comment', 'text');
|
||
9 years ago
|
$this->assertEquals($this->replaceQuotes($expected), $sql);
|
||
9 years ago
|
}
|
||
|
|
||
|
public function testCommentTable()
|
||
|
{
|
||
|
$qb = $this->getQueryBuilder();
|
||
|
|
||
9 years ago
|
$expected = "COMMENT ON TABLE [[comment]] IS 'This is my table.'";
|
||
9 years ago
|
$sql = $qb->addCommentOnTable('comment', 'This is my table.');
|
||
9 years ago
|
$this->assertEquals($this->replaceQuotes($expected), $sql);
|
||
9 years ago
|
|
||
9 years ago
|
$expected = "COMMENT ON TABLE [[comment]] IS ''";
|
||
9 years ago
|
$sql = $qb->dropCommentFromTable('comment');
|
||
9 years ago
|
$this->assertEquals($this->replaceQuotes($expected), $sql);
|
||
9 years ago
|
}
|
||
10 years ago
|
}
|