|
|
|
<?php
|
|
|
|
|
|
|
|
namespace yiiunit\framework\db\sqlite;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @group db
|
|
|
|
* @group sqlite
|
|
|
|
*/
|
|
|
|
class SchemaTest extends \yiiunit\framework\db\SchemaTest
|
|
|
|
{
|
|
|
|
protected $driverName = 'sqlite';
|
|
|
|
|
|
|
|
public function getExpectedColumns()
|
|
|
|
{
|
|
|
|
$columns = parent::getExpectedColumns();
|
|
|
|
unset($columns['enum_col']);
|
|
|
|
unset($columns['bit_col']);
|
|
|
|
$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;
|
|
|
|
$columns['bool_col']['type'] = 'boolean';
|
|
|
|
$columns['bool_col']['phpType'] = 'boolean';
|
|
|
|
$columns['bool_col2']['type'] = 'boolean';
|
|
|
|
$columns['bool_col2']['phpType'] = 'boolean';
|
|
|
|
$columns['bool_col2']['defaultValue'] = true;
|
|
|
|
return $columns;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testCompositeFk()
|
|
|
|
{
|
|
|
|
/* @var $schema Schema */
|
|
|
|
$schema = $this->getConnection()->schema;
|
|
|
|
|
|
|
|
$table = $schema->getTableSchema('composite_fk');
|
|
|
|
|
|
|
|
$this->assertCount(1, $table->foreignKeys);
|
|
|
|
$this->assertTrue(isset($table->foreignKeys[0]));
|
|
|
|
$this->assertEquals('order_item', $table->foreignKeys[0][0]);
|
|
|
|
$this->assertEquals('order_id', $table->foreignKeys[0]['order_id']);
|
|
|
|
$this->assertEquals('item_id', $table->foreignKeys[0]['item_id']);
|
|
|
|
}
|
|
|
|
}
|