pdo-document/tests/Unit/ConfigurationTest.php

37 lines
921 B
PHP
Raw Normal View History

2024-10-05 19:43:41 +00:00
<?php
/**
* @author Daniel J. Summers <daniel@bitbadger.solutions>
* @license MIT
*/
declare(strict_types=1);
use BitBadger\PDODocument\{AutoId, Configuration, DocumentException};
pest()->group('unit');
describe('::$idField', function () {
test('has expected default value', function () {
expect(Configuration::$idField)->toBe('id');
});
});
describe('::$autoId', function () {
test('has expected default value', function () {
expect(Configuration::$autoId)->toBe(AutoId::None);
});
});
describe('::$idStringLength', function () {
test('has expected default value', function () {
expect(Configuration::$idStringLength)->toBe(16);
});
});
describe('::dbConn()', function () {
test('throws if DSN has not been set', function () {
Configuration::useDSN('');
expect(fn() => Configuration::dbConn())->toThrow(DocumentException::class);
});
});