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 RemoveFieldsTest extends TestCase
Configuration::overrideMode(null);
}
#[TestDox('Update succeeds for PostgreSQL')]
#[TestDox('update() succeeds for PostgreSQL')]
public function testUpdateSucceedsForPostgreSQL(): void
{
Configuration::overrideMode(Mode::PgSQL);
@@ -32,7 +32,7 @@ class RemoveFieldsTest extends TestCase
RemoveFields::update('taco', [':names' => "{one,two}"], 'it = true'), 'UPDATE statement not correct');
}
#[TestDox('Update succeeds for SQLite')]
#[TestDox('update() succeeds for SQLite')]
public function testUpdateSucceedsForSQLite(): void
{
Configuration::overrideMode(Mode::SQLite);
@@ -41,22 +41,23 @@ class RemoveFieldsTest extends TestCase
'UPDATE statement not correct');
}
#[TestDox('update() fails when mode not set')]
public function testUpdateFailsWhenModeNotSet(): void
{
$this->expectException(DocumentException::class);
RemoveFields::update('wow', [], '');
}
#[TestDox('By ID succeeds for PostgreSQL')]
public function testByIdSucceedsForPostgreSQL()
#[TestDox('byId() succeeds for PostgreSQL')]
public function testByIdSucceedsForPostgreSQL(): void
{
Configuration::overrideMode(Mode::PgSQL);
$this->assertEquals("UPDATE churro SET data = data - :bite::text[] WHERE data->>'id' = :id",
RemoveFields::byId('churro', Parameters::fieldNames(':bite', ['byte'])), 'UPDATE statement not correct');
}
#[TestDox('By ID succeeds for SQLite')]
public function testByIdSucceedsForSQLite()
#[TestDox('byId() succeeds for SQLite')]
public function testByIdSucceedsForSQLite(): void
{
Configuration::overrideMode(Mode::SQLite);
$this->assertEquals("UPDATE quesadilla SET data = json_remove(data, :bite0) WHERE data->>'id' = :id",
@@ -64,41 +65,42 @@ class RemoveFieldsTest extends TestCase
'UPDATE statement 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);
RemoveFields::byId('oof', []);
}
#[TestDox('By fields succeeds for PostgreSQL')]
public function testByFieldsSucceedsForPostgreSQL()
#[TestDox('byFields() succeeds for PostgreSQL')]
public function testByFieldsSucceedsForPostgreSQL(): void
{
Configuration::overrideMode(Mode::PgSQL);
$this->assertEquals("UPDATE enchilada SET data = data - :sauce::text[] WHERE data->>'cheese' = :queso",
RemoveFields::byFields('enchilada', [Field::EQ('cheese', 'jack', ':queso')],
RemoveFields::byFields('enchilada', [Field::equal('cheese', 'jack', ':queso')],
Parameters::fieldNames(':sauce', ['white'])),
'UPDATE statement not correct');
}
#[TestDox('By fields succeeds for SQLite')]
public function testByFieldsSucceedsForSQLite()
#[TestDox('byFields() succeeds for SQLite')]
public function testByFieldsSucceedsForSQLite(): void
{
Configuration::overrideMode(Mode::SQLite);
$this->assertEquals(
"UPDATE chimichanga SET data = json_remove(data, :filling0) WHERE data->>'side' = :rice",
RemoveFields::byFields('chimichanga', [Field::EQ('side', 'beans', ':rice')],
RemoveFields::byFields('chimichanga', [Field::equal('side', 'beans', ':rice')],
Parameters::fieldNames(':filling', ['beef'])),
'UPDATE statement not correct');
}
#[TestDox('byFields() fails when mode not set')]
public function testByFieldsFailsWhenModeNotSet(): void
{
$this->expectException(DocumentException::class);
RemoveFields::byFields('boing', [], []);
}
#[TestDox('By contains succeeds for PostgreSQL')]
#[TestDox('byContains() succeeds for PostgreSQL')]
public function testByContainsSucceedsForPostgreSQL(): void
{
Configuration::overrideMode(Mode::PgSQL);
@@ -107,14 +109,14 @@ class RemoveFieldsTest extends TestCase
'UPDATE statement not correct');
}
#[TestDox('By contains fails for non PostgreSQL')]
#[TestDox('byContains() fails for non PostgreSQL')]
public function testByContainsFailsForNonPostgreSQL(): void
{
$this->expectException(DocumentException::class);
RemoveFields::byContains('', []);
}
#[TestDox('By JSON Path succeeds for PostgreSQL')]
#[TestDox('byJsonPath() succeeds for PostgreSQL')]
public function testByJsonPathSucceedsForPostgreSQL(): void
{
Configuration::overrideMode(Mode::PgSQL);
@@ -124,7 +126,7 @@ class RemoveFieldsTest extends TestCase
'UPDATE statement not correct');
}
#[TestDox('By JSON Path fails for non PostgreSQL')]
#[TestDox('byJsonPath() fails for non PostgreSQL')]
public function testByJsonPathFailsForNonPostgreSQL(): void
{
$this->expectException(DocumentException::class);