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:
@@ -25,21 +25,23 @@ class CountTest extends TestCase
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
#[TestDox('all() succeeds')]
|
||||
public function testAllSucceeds(): void
|
||||
{
|
||||
$this->assertEquals('SELECT COUNT(*) FROM a_table', Count::all('a_table'),
|
||||
'SELECT statement not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('byFields() succeeds')]
|
||||
public function testByFieldsSucceeds(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
$this->assertEquals("SELECT COUNT(*) FROM somewhere WHERE data->>'errors' > :errors",
|
||||
Count::byFields('somewhere', [Field::GT('errors', 10, ':errors')]),
|
||||
Count::byFields('somewhere', [Field::greater('errors', 10, ':errors')]),
|
||||
'SELECT statement not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('By contains succeeds for PostgreSQL')]
|
||||
#[TestDox('byContains() succeeds for PostgreSQL')]
|
||||
public function testByContainsSucceedsForPostgreSQL(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -47,14 +49,14 @@ class CountTest extends TestCase
|
||||
'SELECT statement not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('By contains fails for non PostgreSQL')]
|
||||
#[TestDox('byContains() fails for non PostgreSQL')]
|
||||
public function testByContainsFailsForNonPostgreSQL(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
Count::byContains('');
|
||||
}
|
||||
|
||||
#[TestDox('By JSON Path succeeds for PostgreSQL')]
|
||||
#[TestDox('byJsonPath() succeeds for PostgreSQL')]
|
||||
public function testByJsonPathSucceedsForPostgreSQL(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -62,7 +64,7 @@ class CountTest extends TestCase
|
||||
Count::byJsonPath('a_table'), 'SELECT statement not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('By JSON Path fails for non PostgreSQL')]
|
||||
#[TestDox('byJsonPath() fails for non PostgreSQL')]
|
||||
public function testByJsonPathFailsForNonPostgreSQL(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
|
||||
@@ -25,7 +25,7 @@ class DefinitionTest extends TestCase
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
#[TestDox('Ensure table succeeds for PosgtreSQL')]
|
||||
#[TestDox('ensureTable() succeeds for PosgtreSQL')]
|
||||
public function testEnsureTableSucceedsForPostgreSQL(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -33,7 +33,7 @@ class DefinitionTest extends TestCase
|
||||
Definition::ensureTable('documents'), 'CREATE TABLE statement not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('Ensure table succeeds for SQLite')]
|
||||
#[TestDox('ensureTable() succeeds for SQLite')]
|
||||
public function testEnsureTableSucceedsForSQLite(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
@@ -41,18 +41,21 @@ class DefinitionTest extends TestCase
|
||||
'CREATE TABLE statement not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('ensureTable() fails when mode not set')]
|
||||
public function testEnsureTableFailsWhenModeNotSet(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
Definition::ensureTable('boom');
|
||||
}
|
||||
|
||||
#[TestDox('ensureIndexOn() succeeds without schema single ascending field')]
|
||||
public function testEnsureIndexOnSucceedsWithoutSchemaSingleAscendingField(): void
|
||||
{
|
||||
$this->assertEquals("CREATE INDEX IF NOT EXISTS idx_test_fields ON test ((data->>'details'))",
|
||||
Definition::ensureIndexOn('test', 'fields', ['details']), 'CREATE INDEX statement not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('ensureIndexOn() succeeds with schema multiple fields')]
|
||||
public function testEnsureIndexOnSucceedsWithSchemaMultipleFields(): void
|
||||
{
|
||||
$this->assertEquals(
|
||||
@@ -61,12 +64,14 @@ class DefinitionTest extends TestCase
|
||||
'CREATE INDEX statement not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('ensureKey() succeeds')]
|
||||
public function testEnsureKeySucceeds(): void
|
||||
{
|
||||
$this->assertEquals("CREATE UNIQUE INDEX IF NOT EXISTS idx_tbl_key ON tbl ((data->>'id'))",
|
||||
Definition::ensureKey('tbl'), 'CREATE INDEX statement for document key not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('ensureDocumentIndexOn() succeeds for schema and Full')]
|
||||
public function testEnsureDocumentIndexOnSucceedsForSchemaAndFull(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -74,6 +79,7 @@ class DefinitionTest extends TestCase
|
||||
Definition::ensureDocumentIndexOn('my.tbl', DocumentIndex::Full));
|
||||
}
|
||||
|
||||
#[TestDox('ensureDocumentIndexOn() succeeds for no schema and Optimized')]
|
||||
public function testEnsureDocumentIndexOnSucceedsForNoSchemaAndOptimized(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -81,7 +87,7 @@ class DefinitionTest extends TestCase
|
||||
Definition::ensureDocumentIndexOn('it', DocumentIndex::Optimized));
|
||||
}
|
||||
|
||||
#[TestDox('Ensure document index on fails for non PostgreSQL')]
|
||||
#[TestDox('ensureDocumentIndexOn() fails for non PostgreSQL')]
|
||||
public function testEnsureDocumentIndexOnFailsForNonPostgreSQL(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
|
||||
@@ -24,7 +24,7 @@ class DeleteTest extends TestCase
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
|
||||
#[TestDox('By ID succeeds')]
|
||||
#[TestDox('byId() succeeds')]
|
||||
public function testByIdSucceeds(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
@@ -32,15 +32,17 @@ class DeleteTest extends TestCase
|
||||
'DELETE statement not constructed correctly');
|
||||
}
|
||||
|
||||
#[TestDox('byFields() succeeds')]
|
||||
public function testByFieldsSucceeds(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
$this->assertEquals("DELETE FROM my_table WHERE data->>'value' < :max AND data->>'value' >= :min",
|
||||
Delete::byFields('my_table', [Field::LT('value', 99, ':max'), Field::GE('value', 18, ':min')]),
|
||||
Delete::byFields('my_table',
|
||||
[Field::less('value', 99, ':max'), Field::greaterOrEqual('value', 18, ':min')]),
|
||||
'DELETE statement not constructed correctly');
|
||||
}
|
||||
|
||||
#[TestDox('By contains succeeds for PostgreSQL')]
|
||||
#[TestDox('byContains() succeeds for PostgreSQL')]
|
||||
public function testByContainsSucceedsForPostgreSQL(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -48,14 +50,14 @@ class DeleteTest extends TestCase
|
||||
'DELETE statement not constructed correctly');
|
||||
}
|
||||
|
||||
#[TestDox('By contains fails for non PostgreSQL')]
|
||||
#[TestDox('byContains() fails for non PostgreSQL')]
|
||||
public function testByContainsFailsForNonPostgreSQL(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
Delete::byContains('');
|
||||
}
|
||||
|
||||
#[TestDox('By JSON Path succeeds for PostgreSQL')]
|
||||
#[TestDox('byJsonPath() succeeds for PostgreSQL')]
|
||||
public function testByJsonPathSucceedsForPostgreSQL(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -63,7 +65,7 @@ class DeleteTest extends TestCase
|
||||
Delete::byJsonPath('here'), 'DELETE statement not constructed correctly');
|
||||
}
|
||||
|
||||
#[TestDox('By JSON Path fails for non PostgreSQL')]
|
||||
#[TestDox('byJsonPath() fails for non PostgreSQL')]
|
||||
public function testByJsonPathFailsForNonPostgreSQL(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
|
||||
@@ -24,6 +24,7 @@ class ExistsTest extends TestCase
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
|
||||
#[TestDox('query() succeeds')]
|
||||
public function testQuerySucceeds(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
@@ -31,7 +32,7 @@ class ExistsTest extends TestCase
|
||||
'Existence query not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('By ID succeeds')]
|
||||
#[TestDox('byId() succeeds')]
|
||||
public function testByIdSucceeds(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
@@ -39,15 +40,16 @@ class ExistsTest extends TestCase
|
||||
'Existence query not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('byFields() succeeds')]
|
||||
public function testByFieldsSucceeds(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
$this->assertEquals("SELECT EXISTS (SELECT 1 FROM box WHERE data->>'status' <> :status)",
|
||||
Exists::byFields('box', [Field::NE('status', 'occupied', ':status')]),
|
||||
Exists::byFields('box', [Field::notEqual('status', 'occupied', ':status')]),
|
||||
'Existence query not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('By contains succeeds for PostgreSQL')]
|
||||
#[TestDox('byContains() succeeds for PostgreSQL')]
|
||||
public function testByContainsSucceedsForPostgreSQL(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -55,14 +57,14 @@ class ExistsTest extends TestCase
|
||||
Exists::byContains('pocket'), 'Existence query not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('By contains fails for non PostgreSQL')]
|
||||
#[TestDox('byContains() fails for non PostgreSQL')]
|
||||
public function testByContainsFailsForNonPostgreSQL(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
Exists::byContains('');
|
||||
}
|
||||
|
||||
#[TestDox('By JSON Path succeeds for PostgreSQL')]
|
||||
#[TestDox('byJsonPath() succeeds for PostgreSQL')]
|
||||
public function testByJsonPathSucceedsForPostgreSQL(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -70,7 +72,7 @@ class ExistsTest extends TestCase
|
||||
Exists::byJsonPath('lint'), 'Existence query not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('By JSON Path fails for non PostgreSQL')]
|
||||
#[TestDox('byJsonPath() fails for non PostgreSQL')]
|
||||
public function testByJsonPathFailsForNonPostgreSQL(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
|
||||
@@ -24,7 +24,7 @@ class FindTest extends TestCase
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
|
||||
#[TestDox('By ID succeeds')]
|
||||
#[TestDox('byId() succeeds')]
|
||||
public function testByIdSucceeds(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
@@ -32,16 +32,17 @@ class FindTest extends TestCase
|
||||
'SELECT query not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('byFields() succeeds')]
|
||||
public function testByFieldsSucceeds(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
$this->assertEquals("SELECT data FROM there WHERE data->>'active' = :act OR data->>'locked' = :lock",
|
||||
Find::byFields('there', [Field::EQ('active', true, ':act'), Field::EQ('locked', true, ':lock')],
|
||||
Find::byFields('there', [Field::equal('active', true, ':act'), Field::equal('locked', true, ':lock')],
|
||||
FieldMatch::Any),
|
||||
'SELECT query not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('By contains succeeds for PostgreSQL')]
|
||||
#[TestDox('byContains() succeeds for PostgreSQL')]
|
||||
public function testByContainsSucceedsForPostgreSQL(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -49,14 +50,14 @@ class FindTest extends TestCase
|
||||
'SELECT query not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('By contains fails for non PostgreSQL')]
|
||||
#[TestDox('byContains() fails for non PostgreSQL')]
|
||||
public function testByContainsFailsForNonPostgreSQL(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
Find::byContains('');
|
||||
}
|
||||
|
||||
#[TestDox('By JSON Path succeeds for PostgreSQL')]
|
||||
#[TestDox('byJsonPath() succeeds for PostgreSQL')]
|
||||
public function testByJsonPathSucceedsForPostgreSQL(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -64,7 +65,7 @@ class FindTest extends TestCase
|
||||
Find::byJsonPath('light'), 'SELECT query not generated correctly');
|
||||
}
|
||||
|
||||
#[TestDox('By JSON Path fails for non PostgreSQL')]
|
||||
#[TestDox('byJsonPath() fails for non PostgreSQL')]
|
||||
public function testByJsonPathFailsForNonPostgreSQL(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user