Derive mode from DSN function
- Add headers in all files - Minor field name changes
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
<?php declare(strict_types=1);
|
||||
<?php
|
||||
/**
|
||||
* @author Daniel J. Summers <daniel@bitbadger.solutions>
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Test\Unit\Query;
|
||||
|
||||
@@ -15,14 +21,14 @@ class DefinitionTest extends TestCase
|
||||
{
|
||||
protected function tearDown(): void
|
||||
{
|
||||
Configuration::$mode = null;
|
||||
Configuration::overrideMode(null);
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
#[TestDox('Ensure table succeeds for PosgtreSQL')]
|
||||
public function testEnsureTableSucceedsForPostgreSQL(): void
|
||||
{
|
||||
Configuration::$mode = Mode::PgSQL;
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
$this->assertEquals('CREATE TABLE IF NOT EXISTS documents (data JSONB NOT NULL)',
|
||||
Definition::ensureTable('documents'), 'CREATE TABLE statement not generated correctly');
|
||||
}
|
||||
@@ -30,7 +36,7 @@ class DefinitionTest extends TestCase
|
||||
#[TestDox('Ensure table succeeds for SQLite')]
|
||||
public function testEnsureTableSucceedsForSQLite(): void
|
||||
{
|
||||
Configuration::$mode = Mode::SQLite;
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
$this->assertEquals('CREATE TABLE IF NOT EXISTS dox (data TEXT NOT NULL)', Definition::ensureTable('dox'),
|
||||
'CREATE TABLE statement not generated correctly');
|
||||
}
|
||||
@@ -63,14 +69,14 @@ class DefinitionTest extends TestCase
|
||||
|
||||
public function testEnsureDocumentIndexOnSucceedsForSchemaAndFull(): void
|
||||
{
|
||||
Configuration::$mode = Mode::PgSQL;
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
$this->assertEquals("CREATE INDEX IF NOT EXISTS idx_tbl_document ON my.tbl USING GIN (data)",
|
||||
Definition::ensureDocumentIndexOn('my.tbl', DocumentIndex::Full));
|
||||
}
|
||||
|
||||
public function testEnsureDocumentIndexOnSucceedsForNoSchemaAndOptimized(): void
|
||||
{
|
||||
Configuration::$mode = Mode::PgSQL;
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
$this->assertEquals("CREATE INDEX IF NOT EXISTS idx_it_document ON it USING GIN (data jsonb_path_ops)",
|
||||
Definition::ensureDocumentIndexOn('it', DocumentIndex::Optimized));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user