Add PostgreSQL Support (#3)
Reviewed-on: #3
This commit was merged in pull request #3.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Test\Integration\SQLite;
|
||||
|
||||
use BitBadger\PDODocument\{Custom, Document, Field, Find};
|
||||
use BitBadger\PDODocument\{Custom, Document, DocumentException, Field, Find};
|
||||
use PHPUnit\Framework\Attributes\TestDox;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Test\Integration\TestDocument;
|
||||
@@ -82,11 +82,22 @@ class FindTest extends TestCase
|
||||
{
|
||||
$docs = Find::byFields(ThrowawayDb::TABLE, [Field::GT('num_value', 100)], TestDocument::class);
|
||||
$this->assertNotNull($docs, 'There should have been a document list returned');
|
||||
$count = 0;
|
||||
foreach ($docs->items() as $ignored) $count++;
|
||||
$this->assertFalse($docs->hasItems(), 'There should have been no documents in the list');
|
||||
}
|
||||
|
||||
public function testByContainsFails(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
Find::byContains('', [], TestDocument::class);
|
||||
}
|
||||
|
||||
#[TestDox('By JSON Path fails')]
|
||||
public function testByJsonPathFails(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
Find::byJsonPath('', '', TestDocument::class);
|
||||
}
|
||||
|
||||
public function testFirstByFieldsSucceedsWhenADocumentIsFound(): void
|
||||
{
|
||||
$doc = Find::firstByFields(ThrowawayDb::TABLE, [Field::EQ('value', 'another')], TestDocument::class);
|
||||
@@ -106,4 +117,17 @@ class FindTest extends TestCase
|
||||
$doc = Find::firstByFields(ThrowawayDb::TABLE, [Field::EQ('value', 'absent')], TestDocument::class);
|
||||
$this->assertFalse($doc, 'There should not have been a document returned');
|
||||
}
|
||||
|
||||
public function testFirstByContainsFails(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
Find::firstByContains('', [], TestDocument::class);
|
||||
}
|
||||
|
||||
#[TestDox('First by JSON Path fails')]
|
||||
public function testFirstByJsonPathFails(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
Find::firstByJsonPath('', '', TestDocument::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user