Migrate tests to Pest (#8)
Reviewed-on: #8
This commit was merged in pull request #8.
This commit is contained in:
36
tests/Integration/SQLite/DefinitionTest.php
Normal file
36
tests/Integration/SQLite/DefinitionTest.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Daniel J. Summers <daniel@bitbadger.solutions>
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use BitBadger\PDODocument\{Definition, DocumentException, DocumentIndex};
|
||||
|
||||
pest()->group('integration', 'sqlite');
|
||||
|
||||
describe('::ensureTable()', function () {
|
||||
test('creates table and PK index', function () {
|
||||
expect($this->dbObjectExists('ensured'))->toBeFalse()
|
||||
->and($this->dbObjectExists('idx_ensured_key'))->toBeFalse();
|
||||
Definition::ensureTable('ensured');
|
||||
expect($this->dbObjectExists('ensured'))->toBeTrue()
|
||||
->and($this->dbObjectExists('idx_ensured_key'))->toBeTrue();
|
||||
});
|
||||
});
|
||||
|
||||
describe('::ensureFieldIndex()', function () {
|
||||
test('creates an index', function () {
|
||||
expect($this->dbObjectExists('idx_ensured_test'))->toBeFalse();
|
||||
Definition::ensureTable('ensured');
|
||||
Definition::ensureFieldIndex('ensured', 'test', ['name', 'age']);
|
||||
expect($this->dbObjectExists('idx_ensured_test'))->toBeTrue();
|
||||
});
|
||||
});
|
||||
|
||||
describe('::ensureDocumentIndex()', function () {
|
||||
test('throws an exception', function () {
|
||||
expect(fn () => Definition::ensureDocumentIndex('', DocumentIndex::Full))->toThrow(DocumentException::class);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user