Skip to content

Commit

Permalink
Added tests for indexes and constraints (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdef committed Dec 18, 2022
1 parent 08cba81 commit d5a9848
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/SchemaTest.php
Expand Up @@ -11,6 +11,7 @@
use Yiisoft\Db\Exception\InvalidConfigException;
use Yiisoft\Db\Exception\NotSupportedException;
use Yiisoft\Db\Expression\Expression;
use Yiisoft\Db\Pgsql\QueryBuilder;
use Yiisoft\Db\Pgsql\Schema;
use Yiisoft\Db\Pgsql\Tests\Support\TestTrait;
use Yiisoft\Db\Schema\TableSchemaInterface;
Expand Down Expand Up @@ -430,4 +431,45 @@ public function testTimestampNullDefaultValue(): void
$this->assertNotNull($columnSchema);
$this->assertNull($columnSchema->getDefaultValue());
}

public function testWorkWithDefaultValueConstraint(): void
{
$this->expectException(NotSupportedException::class);
$this->expectExceptionMessage(
'Yiisoft\Db\Pgsql\DDLQueryBuilder::addDefaultValue is not supported by PostgreSQL.'
);

parent::testWorkWithDefaultValueConstraint();
}

public function withIndexDataProvider(): array
{
return array_merge(parent::withIndexDataProvider(), [
[
'indexType' => null,
'indexMethod' => QueryBuilder::INDEX_B_TREE,
'columnType' => 'varchar(16)',
],
[
'indexType' => null,
'indexMethod' => QueryBuilder::INDEX_HASH,
'columnType' => 'varchar(16)',
],
[
'indexType' => null,
'indexMethod' => QueryBuilder::INDEX_BRIN,
'columnType' => 'varchar(16)',
],
[
'indexType' => null,
'indexMethod' => QueryBuilder::INDEX_GIN,
'columnType' => 'jsonb',
],
[
'indexType' => null,
'indexMethod' => QueryBuilder::INDEX_GIST,
'columnType' => 'tsvector',
],
]);
}
}

0 comments on commit d5a9848

Please sign in to comment.