Add in/inArray; expand Field ctr func names

This commit is contained in:
2024-09-20 20:29:47 -04:00
parent 0a188a80c2
commit e830b1ac3e
28 changed files with 466 additions and 299 deletions

View File

@@ -37,20 +37,23 @@ class QueryTest extends TestCase
public function testWhereByFieldsSucceedsForSingleField(): void
{
$this->assertEquals("data->>'test_field' <= :it",
Query::whereByFields([Field::LE('test_field', '', ':it')]), 'WHERE fragment not constructed correctly');
Query::whereByFields([Field::lessOrEqual('test_field', '', ':it')]),
'WHERE fragment not constructed correctly');
}
public function testWhereByFieldsSucceedsForMultipleFieldsAll(): void
{
$this->assertEquals("data->>'test_field' <= :it AND data->>'other_field' = :other",
Query::whereByFields([Field::LE('test_field', '', ':it'), Field::EQ('other_field', '', ':other')]),
Query::whereByFields(
[Field::lessOrEqual('test_field', '', ':it'), Field::equal('other_field', '', ':other')]),
'WHERE fragment not constructed correctly');
}
public function testWhereByFieldsSucceedsForMultipleFieldsAny(): void
{
$this->assertEquals("data->>'test_field' <= :it OR data->>'other_field' = :other",
Query::whereByFields([Field::LE('test_field', '', ':it'), Field::EQ('other_field', '', ':other')],
Query::whereByFields(
[Field::lessOrEqual('test_field', '', ':it'), Field::equal('other_field', '', ':other')],
FieldMatch::Any),
'WHERE fragment not constructed correctly');
}