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

@@ -89,8 +89,8 @@ class RemoveFieldsTest extends TestCase
RemoveFields::byContains(ThrowawayDb::TABLE, $criteria, ['value']);
$docs = Find::byContains(ThrowawayDb::TABLE, $criteria, TestDocument::class);
$this->assertNotNull($docs, 'There should have been a document list returned');
$this->assertTrue($docs->hasItems(), 'The document list should not have been empty');
foreach ($docs->items() as $item) {
$this->assertTrue($docs->hasItems, 'The document list should not have been empty');
foreach ($docs->items as $item) {
$this->assertContains($item->id, ['two', 'four'], 'An incorrect document was returned');
$this->assertEquals('', $item->value, 'The value field was not removed');
}
@@ -117,8 +117,8 @@ class RemoveFieldsTest extends TestCase
RemoveFields::byJsonPath(ThrowawayDb::TABLE, $path, ['sub']);
$docs = Find::byJsonPath(ThrowawayDb::TABLE, $path, TestDocument::class);
$this->assertNotNull($docs, 'There should have been a document list returned');
$this->assertTrue($docs->hasItems(), 'The document list should not have been empty');
foreach ($docs->items() as $item) {
$this->assertTrue($docs->hasItems, 'The document list should not have been empty');
foreach ($docs->items as $item) {
$this->assertContains($item->id, ['four', 'five'], 'An incorrect document was returned');
$this->assertNull($item->sub, 'The sub field was not removed');
}