Finish tests

- Add sub-doc handling for SQLite fields
- Add casting for PostgreSQL BT on numeric value
- Add hasItems() to DocumentList
- Fix SQL syntax problems exposed by tests
This commit is contained in:
2024-06-08 10:49:52 -04:00
parent a96fdf9d14
commit 2d8f8b6e87
21 changed files with 691 additions and 42 deletions

View File

@@ -4,12 +4,14 @@ namespace Test\Integration\SQLite;
use BitBadger\PDODocument\{Count, Custom, DocumentException, Query};
use BitBadger\PDODocument\Mapper\{CountMapper, DocumentMapper};
use PHPUnit\Framework\Attributes\TestDox;
use PHPUnit\Framework\TestCase;
use Test\Integration\TestDocument;
/**
* SQLite Integration tests for the Custom class
*/
#[TestDox('Custom (SQLite integration)')]
class CustomTest extends TestCase
{
/** @var string Database name for throwaway database */
@@ -61,9 +63,7 @@ class CustomTest extends TestCase
$list = Custom::list(Query::selectFromTable(ThrowawayDb::TABLE) . " WHERE data->>'num_value' > :value",
[':value' => 100], new DocumentMapper(TestDocument::class));
$this->assertNotNull($list, 'The document list should not be null');
$count = 0;
foreach ($list->items() as $ignored) $count++;
$this->assertEquals(0, $count, 'There should have been no documents in the list');
$this->assertFalse($list->hasItems(), 'There should have been no documents in the list');
}
public function testArraySucceedsWhenDataIsFound()