pdo-document/tests/Unit/ConfigurationTest.php

37 lines
921 B
PHP

<?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);
});
});