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.
74 lines
2.5 KiB
74 lines
2.5 KiB
11 years ago
|
<?php
|
||
|
namespace yiiunit\framework\db\cubrid;
|
||
|
|
||
10 years ago
|
use yii\db\Expression;
|
||
11 years ago
|
use yiiunit\framework\db\SchemaTest;
|
||
|
|
||
11 years ago
|
/**
|
||
|
* @group db
|
||
|
* @group cubrid
|
||
|
*/
|
||
11 years ago
|
class CubridSchemaTest extends SchemaTest
|
||
|
{
|
||
11 years ago
|
public $driverName = 'cubrid';
|
||
11 years ago
|
|
||
11 years ago
|
public function testGetPDOType()
|
||
|
{
|
||
|
$values = [
|
||
|
[null, \PDO::PARAM_NULL],
|
||
|
['', \PDO::PARAM_STR],
|
||
|
['hello', \PDO::PARAM_STR],
|
||
|
[0, \PDO::PARAM_INT],
|
||
|
[1, \PDO::PARAM_INT],
|
||
|
[1337, \PDO::PARAM_INT],
|
||
|
[true, \PDO::PARAM_INT],
|
||
|
[false, \PDO::PARAM_INT],
|
||
|
[$fp = fopen(__FILE__, 'rb'), \PDO::PARAM_LOB],
|
||
|
];
|
||
11 years ago
|
|
||
10 years ago
|
/* @var $schema Schema */
|
||
11 years ago
|
$schema = $this->getConnection()->schema;
|
||
11 years ago
|
|
||
11 years ago
|
foreach ($values as $value) {
|
||
|
$this->assertEquals($value[1], $schema->getPdoType($value[0]));
|
||
|
}
|
||
|
fclose($fp);
|
||
|
}
|
||
10 years ago
|
|
||
|
|
||
|
public function getExpectedColumns()
|
||
|
{
|
||
|
$columns = parent::getExpectedColumns();
|
||
|
$columns['int_col']['dbType'] = 'integer';
|
||
|
$columns['int_col']['size'] = null;
|
||
|
$columns['int_col']['precision'] = null;
|
||
|
$columns['int_col2']['dbType'] = 'integer';
|
||
|
$columns['int_col2']['size'] = null;
|
||
|
$columns['int_col2']['precision'] = null;
|
||
10 years ago
|
$columns['smallint_col']['dbType'] = 'short';
|
||
10 years ago
|
$columns['smallint_col']['size'] = null;
|
||
|
$columns['smallint_col']['precision'] = null;
|
||
10 years ago
|
$columns['char_col3']['type'] = 'string';
|
||
|
$columns['char_col3']['dbType'] = 'varchar(1073741823)';
|
||
|
$columns['char_col3']['size'] = 1073741823;
|
||
|
$columns['char_col3']['precision'] = 1073741823;
|
||
|
$columns['enum_col']['dbType'] = "enum('a', 'B')";
|
||
|
$columns['float_col']['dbType'] = 'double';
|
||
|
$columns['float_col']['size'] = null;
|
||
|
$columns['float_col']['precision'] = null;
|
||
|
$columns['float_col']['scale'] = null;
|
||
|
$columns['numeric_col']['dbType'] = 'numeric(5,2)';
|
||
|
$columns['blob_col']['phpType'] = 'resource';
|
||
|
$columns['blob_col']['type'] = 'binary';
|
||
|
$columns['bool_col']['dbType'] = 'short';
|
||
|
$columns['bool_col']['size'] = null;
|
||
|
$columns['bool_col']['precision'] = null;
|
||
|
$columns['bool_col2']['dbType'] = 'short';
|
||
|
$columns['bool_col2']['size'] = null;
|
||
|
$columns['bool_col2']['precision'] = null;
|
||
|
$columns['time']['defaultValue'] = '12:00:00 AM 01/01/2002';
|
||
|
$columns['ts_default']['defaultValue'] = new Expression('SYS_TIMESTAMP');
|
||
|
return $columns;
|
||
|
}
|
||
11 years ago
|
}
|