Migrate tests to Pest (#8)
Reviewed-on: #8
This commit was merged in pull request #8.
This commit is contained in:
42
tests/Integration/SQLite/ExistsTest.php
Normal file
42
tests/Integration/SQLite/ExistsTest.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Daniel J. Summers <daniel@bitbadger.solutions>
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use BitBadger\PDODocument\{DocumentException, Exists, Field};
|
||||
use Test\Integration\SQLite\ThrowawayDb;
|
||||
|
||||
pest()->group('integration', 'sqlite');
|
||||
|
||||
describe('::byId()', function () {
|
||||
test('returns true when a document exists', function () {
|
||||
expect(Exists::byId(ThrowawayDb::TABLE, 'three'))->toBeTrue();
|
||||
});
|
||||
test('returns false when no document exists', function () {
|
||||
expect(Exists::byId(ThrowawayDb::TABLE, 'seven'))->toBeFalse();
|
||||
});
|
||||
});
|
||||
|
||||
describe('::byFields()', function () {
|
||||
test('returns true when matching documents exist', function () {
|
||||
expect(Exists::byFields(ThrowawayDb::TABLE, [Field::equal('num_value', 10)]))->toBeTrue();
|
||||
});
|
||||
test('returns false when no matching documents exist', function () {
|
||||
expect(Exists::byFields(ThrowawayDb::TABLE, [Field::less('nothing', 'none')]))->toBeFalse();
|
||||
});
|
||||
});
|
||||
|
||||
describe('::byContains()', function () {
|
||||
test('throws an exception', function () {
|
||||
expect(fn () => Exists::byContains('', []))->toThrow(DocumentException::class);
|
||||
});
|
||||
});
|
||||
|
||||
describe('::byJsonPath()', function () {
|
||||
test('throws an exception', function () {
|
||||
expect(fn () => Exists::byJsonPath('', ''))->toThrow(DocumentException::class);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user