Changes for beta10 (#5)
- Add In/InArray support - Add ORDER BY support for `Find` functions - Update dependencies - Implement fixes identified via static analysis Reviewed-on: #5
This commit was merged in pull request #5.
This commit is contained in:
@@ -34,7 +34,7 @@ class PatchTest extends TestCase
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
#[TestDox('By ID succeeds when a document is updated')]
|
||||
#[TestDox('byId() succeeds when a document is updated')]
|
||||
public function testByIdSucceedsWhenADocumentIsUpdated(): void
|
||||
{
|
||||
Patch::byId(ThrowawayDb::TABLE, 'one', ['num_value' => 44]);
|
||||
@@ -43,7 +43,7 @@ class PatchTest extends TestCase
|
||||
$this->assertEquals(44, $doc->get()->num_value, 'The updated document is not correct');
|
||||
}
|
||||
|
||||
#[TestDox('By ID succeeds when no document is updated')]
|
||||
#[TestDox('byId() succeeds when no document is updated')]
|
||||
public function testByIdSucceedsWhenNoDocumentIsUpdated(): void
|
||||
{
|
||||
$id = 'forty-seven';
|
||||
@@ -52,21 +52,24 @@ class PatchTest extends TestCase
|
||||
$this->assertTrue(true, 'The above not throwing an exception is the test');
|
||||
}
|
||||
|
||||
#[TestDox('byFields() succeeds when a document is updated')]
|
||||
public function testByFieldsSucceedsWhenADocumentIsUpdated(): void
|
||||
{
|
||||
Patch::byFields(ThrowawayDb::TABLE, [Field::EQ('value', 'purple')], ['num_value' => 77]);
|
||||
$after = Count::byFields(ThrowawayDb::TABLE, [Field::EQ('num_value', 77)]);
|
||||
Patch::byFields(ThrowawayDb::TABLE, [Field::equal('value', 'purple')], ['num_value' => 77]);
|
||||
$after = Count::byFields(ThrowawayDb::TABLE, [Field::equal('num_value', 77)]);
|
||||
$this->assertEquals(2, $after, 'There should have been 2 documents updated');
|
||||
}
|
||||
|
||||
#[TestDox('byFields() succeeds when no document is updated')]
|
||||
public function testByFieldsSucceedsWhenNoDocumentIsUpdated(): void
|
||||
{
|
||||
$fields = [Field::EQ('value', 'burgundy')];
|
||||
$fields = [Field::equal('value', 'burgundy')];
|
||||
$this->assertEquals(0, Count::byFields(ThrowawayDb::TABLE, $fields), 'There should be no matching documents');
|
||||
Patch::byFields(ThrowawayDb::TABLE, $fields, ['foo' => 'green']);
|
||||
$this->assertTrue(true, 'The above not throwing an exception is the test');
|
||||
}
|
||||
|
||||
#[TestDox('byContains() succeeds when documents are updated')]
|
||||
public function testByContainsSucceedsWhenDocumentsAreUpdated(): void
|
||||
{
|
||||
Patch::byContains(ThrowawayDb::TABLE, ['value' => 'another'], ['num_value' => 12]);
|
||||
@@ -77,6 +80,7 @@ class PatchTest extends TestCase
|
||||
$this->assertEquals(12, $doc->num_value, 'The document was not patched');
|
||||
}
|
||||
|
||||
#[TestDox('byContains() succeeds when no documents are updated')]
|
||||
public function testByContainsSucceedsWhenNoDocumentsAreUpdated(): void
|
||||
{
|
||||
$criteria = ['value' => 'updated'];
|
||||
@@ -86,7 +90,7 @@ class PatchTest extends TestCase
|
||||
$this->assertTrue(true, 'The above not throwing an exception is the test');
|
||||
}
|
||||
|
||||
#[TestDox('By JSON Path succeeds when documents are updated')]
|
||||
#[TestDox('byJsonPath() succeeds when documents are updated')]
|
||||
public function testByJsonPathSucceedsWhenDocumentsAreUpdated(): void
|
||||
{
|
||||
Patch::byJsonPath(ThrowawayDb::TABLE, '$.num_value ? (@ > 10)', ['value' => 'blue']);
|
||||
@@ -99,7 +103,7 @@ class PatchTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('By JSON Path succeeds when documents are not updated')]
|
||||
#[TestDox('byJsonPath() succeeds when documents are not updated')]
|
||||
public function testByJsonPathSucceedsWhenDocumentsAreNotUpdated(): void
|
||||
{
|
||||
$path = '$.num_value ? (@ > 100)';
|
||||
|
||||
Reference in New Issue
Block a user