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:
2024-09-27 02:15:00 +00:00
parent 9e0e663811
commit d067f8983f
66 changed files with 1728 additions and 664 deletions

View File

@@ -24,7 +24,7 @@ class PatchTest extends TestCase
Configuration::overrideMode(null);
parent::tearDown();
}
#[TestDox('By ID succeeds for PostgreSQL')]
#[TestDox('byId() succeeds for PostgreSQL')]
public function testByIdSucceedsForPostgreSQL(): void
{
Configuration::overrideMode(Mode::PgSQL);
@@ -32,7 +32,7 @@ class PatchTest extends TestCase
Patch::byId('doc_table'), 'Patch UPDATE statement is not correct');
}
#[TestDox('By ID succeeds for SQLite')]
#[TestDox('byId() succeeds for SQLite')]
public function testByIdSucceedsForSQLite(): void
{
Configuration::overrideMode(Mode::SQLite);
@@ -40,37 +40,39 @@ class PatchTest extends TestCase
Patch::byId('my_table'), 'Patch UPDATE statement is not correct');
}
#[TestDox('By ID fails when mode not set')]
#[TestDox('byId() fails when mode not set')]
public function testByIdFailsWhenModeNotSet(): void
{
$this->expectException(DocumentException::class);
Patch::byId('oof');
}
#[TestDox('By fields succeeds for PostgreSQL')]
#[TestDox('byFields() succeeds for PostgreSQL')]
public function testByFieldsSucceedsForPostgreSQL(): void
{
Configuration::overrideMode(Mode::PgSQL);
$this->assertEquals("UPDATE that SET data = data || :data WHERE (data->>'something')::numeric < :some",
Patch::byFields('that', [Field::LT('something', 17, ':some')]), 'Patch UPDATE statement is not correct');
Patch::byFields('that', [Field::less('something', 17, ':some')]), 'Patch UPDATE statement is not correct');
}
#[TestDox('By fields succeeds for SQLite')]
#[TestDox('byFields() succeeds for SQLite')]
public function testByFieldsSucceedsForSQLite(): void
{
Configuration::overrideMode(Mode::SQLite);
$this->assertEquals(
"UPDATE a_table SET data = json_patch(data, json(:data)) WHERE data->>'something' > :it",
Patch::byFields('a_table', [Field::GT('something', 17, ':it')]), 'Patch UPDATE statement is not correct');
Patch::byFields('a_table', [Field::greater('something', 17, ':it')]),
'Patch UPDATE statement is not correct');
}
#[TestDox('byFields() fails when mode not set')]
public function testByFieldsFailsWhenModeNotSet(): void
{
$this->expectException(DocumentException::class);
Patch::byFields('oops', []);
}
#[TestDox('By contains succeeds for PostgreSQL')]
#[TestDox('byContains() succeeds for PostgreSQL')]
public function testByContainsSucceedsForPostgreSQL(): void
{
Configuration::overrideMode(Mode::PgSQL);
@@ -78,14 +80,14 @@ class PatchTest extends TestCase
'Patch UPDATE statement is not correct');
}
#[TestDox('By contains fails for non PostgreSQL')]
#[TestDox('byContains() fails for non PostgreSQL')]
public function testByContainsFailsForNonPostgreSQL(): void
{
$this->expectException(DocumentException::class);
Patch::byContains('');
}
#[TestDox('By JSON Path succeeds for PostgreSQL')]
#[TestDox('byJsonPath() succeeds for PostgreSQL')]
public function testByJsonPathSucceedsForPostgreSQL(): void
{
Configuration::overrideMode(Mode::PgSQL);
@@ -93,7 +95,7 @@ class PatchTest extends TestCase
Patch::byJsonPath('that'), 'Patch UPDATE statement is not correct');
}
#[TestDox('By JSON Path fails for non PostgreSQL')]
#[TestDox('byJsonPath() fails for non PostgreSQL')]
public function testByJsonPathFailsForNonPostgreSQL(): void
{
$this->expectException(DocumentException::class);