v2 RC1 Changes (#7)
- Changes `items` and `hasItems` on `DocumentList` to be properties - Updates dependent option/result library, which contains similar changes Reviewed-on: #7
This commit was merged in pull request #7.
This commit is contained in:
@@ -39,8 +39,8 @@ class PatchTest extends TestCase
|
||||
{
|
||||
Patch::byId(ThrowawayDb::TABLE, 'one', ['num_value' => 44]);
|
||||
$doc = Find::byId(ThrowawayDb::TABLE, 'one', TestDocument::class);
|
||||
$this->assertTrue($doc->isSome(), 'There should have been a document returned');
|
||||
$this->assertEquals(44, $doc->get()->num_value, 'The updated document is not correct');
|
||||
$this->assertTrue($doc->isSome, 'There should have been a document returned');
|
||||
$this->assertEquals(44, $doc->value->num_value, 'The updated document is not correct');
|
||||
}
|
||||
|
||||
#[TestDox('byId() succeeds when no document is updated')]
|
||||
@@ -74,8 +74,8 @@ class PatchTest extends TestCase
|
||||
{
|
||||
Patch::byContains(ThrowawayDb::TABLE, ['value' => 'another'], ['num_value' => 12]);
|
||||
$tryDoc = Find::firstByContains(ThrowawayDb::TABLE, ['value' => 'another'], TestDocument::class);
|
||||
$this->assertTrue($tryDoc->isSome(), 'There should have been a document returned');
|
||||
$doc = $tryDoc->get();
|
||||
$this->assertTrue($tryDoc->isSome, 'There should have been a document returned');
|
||||
$doc = $tryDoc->value;
|
||||
$this->assertEquals('two', $doc->id, 'An incorrect document was returned');
|
||||
$this->assertEquals(12, $doc->num_value, 'The document was not patched');
|
||||
}
|
||||
@@ -96,8 +96,8 @@ class PatchTest extends TestCase
|
||||
Patch::byJsonPath(ThrowawayDb::TABLE, '$.num_value ? (@ > 10)', ['value' => 'blue']);
|
||||
$docs = Find::byJsonPath(ThrowawayDb::TABLE, '$.num_value ? (@ > 10)', TestDocument::class);
|
||||
$this->assertNotNull($docs, 'There should have been a document list returned');
|
||||
$this->assertTrue($docs->hasItems(), 'The document list should not be empty');
|
||||
foreach ($docs->items() as $item) {
|
||||
$this->assertTrue($docs->hasItems, 'The document list should not be empty');
|
||||
foreach ($docs->items as $item) {
|
||||
$this->assertContains($item->id, ['four', 'five'], 'An incorrect document was returned');
|
||||
$this->assertEquals('blue', $item->value, 'The document was not patched');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user