Migrate tests to Pest (#8)
Reviewed-on: #8
This commit was merged in pull request #8.
This commit is contained in:
28
tests/Unit/Mapper/ExistsMapperTest.php
Normal file
28
tests/Unit/Mapper/ExistsMapperTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Daniel J. Summers <daniel@bitbadger.solutions>
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use BitBadger\PDODocument\{Configuration, DocumentException, Mode};
|
||||
use BitBadger\PDODocument\Mapper\ExistsMapper;
|
||||
|
||||
pest()->group('unit');
|
||||
|
||||
afterEach(function () { Configuration::overrideMode(null); });
|
||||
|
||||
describe('->map()', function () {
|
||||
test('returns a boolean value from index 0 [PostgreSQL]', function () {
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
expect((new ExistsMapper())->map([false, 'nope']))->toBeFalse();
|
||||
});
|
||||
test('returns a number value as boolean from index 0 [SQLite]', function () {
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
expect((new ExistsMapper())->map([1, 'yep']))->toBeTrue();
|
||||
});
|
||||
test('throws if mode is not set', function () {
|
||||
expect(fn() => (new ExistsMapper())->map(['0']))->toThrow(DocumentException::class);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user