Add PostgreSQL Support (#3)

Reviewed-on: #3
This commit was merged in pull request #3.
This commit is contained in:
2024-06-21 13:46:41 +00:00
parent 330e272187
commit 124426fa12
61 changed files with 2290 additions and 223 deletions

View File

@@ -2,7 +2,7 @@
namespace Test\Integration\SQLite;
use BitBadger\PDODocument\{Custom, Definition, DocumentException};
use BitBadger\PDODocument\{Custom, Definition, DocumentException, DocumentIndex};
use BitBadger\PDODocument\Mapper\ExistsMapper;
use PHPUnit\Framework\Attributes\TestDox;
use PHPUnit\Framework\TestCase;
@@ -41,7 +41,7 @@ class DefinitionTest extends TestCase
[':name' => $name], new ExistsMapper());
}
public function testEnsureTableSucceeds()
public function testEnsureTableSucceeds(): void
{
$this->assertFalse($this->itExists('ensured'), 'The table should not exist already');
$this->assertFalse($this->itExists('idx_ensured_key'), 'The key index should not exist already');
@@ -50,11 +50,17 @@ class DefinitionTest extends TestCase
$this->assertTrue($this->itExists('idx_ensured_key'), 'The key index should now exist');
}
public function testEnsureFieldIndexSucceeds()
public function testEnsureFieldIndexSucceeds(): void
{
$this->assertFalse($this->itExists('idx_ensured_test'), 'The index should not exist already');
Definition::ensureTable('ensured');
Definition::ensureFieldIndex('ensured', 'test', ['name', 'age']);
$this->assertTrue($this->itExists('idx_ensured_test'), 'The index should now exist');
}
public function testEnsureDocumentIndexFails(): void
{
$this->expectException(DocumentException::class);
Definition::ensureDocumentIndex('nope', DocumentIndex::Full);
}
}