Migrate tests to Pest (#8)

Reviewed-on: #8
This commit was merged in pull request #8.
This commit is contained in:
2024-11-17 21:30:53 +00:00
parent df436c9ef4
commit 529e823955
93 changed files with 5725 additions and 5186 deletions

23
tests/Unit/ModeTest.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
/**
* @author Daniel J. Summers <daniel@bitbadger.solutions>
* @license MIT
*/
declare(strict_types=1);
use BitBadger\PDODocument\{DocumentException, Mode};
pest()->group('unit');
describe('::deriveFromDSN()', function () {
test('derives for PostgreSQL', function () {
expect(Mode::deriveFromDSN('pgsql:Host=localhost'))->toBe(Mode::PgSQL);
})->group('postgresql');
test('derives for SQLite', function () {
expect(Mode::deriveFromDSN('sqlite:data.db'))->toBe(Mode::SQLite);
})->group('sqlite');
test('throws for other drivers', function () {
expect(fn() => Mode::deriveFromDSN('mysql:Host=localhost'))->toThrow(DocumentException::class);
});
});