Change doc list hasItems and items to properties

- Update associated tests
This commit is contained in:
2024-10-01 18:39:57 -04:00
parent 4b29345dc7
commit bf04ddfd72
11 changed files with 110 additions and 95 deletions

View File

@@ -62,8 +62,9 @@ class CustomTest extends TestCase
{
$list = Custom::list(Query::selectFromTable(ThrowawayDb::TABLE), [], new DocumentMapper(TestDocument::class));
$this->assertNotNull($list, 'The document list should not be null');
$this->assertTrue($list->hasItems, 'There should have been documents in the list');
$count = 0;
foreach ($list->items() as $ignored) $count++;
foreach ($list->items as $ignored) $count++;
$this->assertEquals(5, $count, 'There should have been 5 documents in the list');
}
@@ -73,7 +74,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');
$this->assertFalse($list->hasItems(), 'There should have been no documents in the list');
$this->assertFalse($list->hasItems, 'There should have been no documents in the list');
}
#[TestDox('array() succeeds when data is found')]