Implement In/InArray
- WIP on testdox name changes
This commit is contained in:
@@ -18,33 +18,166 @@ use PHPUnit\Framework\TestCase;
|
||||
#[TestDox('Field (Unit tests)')]
|
||||
class FieldTest extends TestCase
|
||||
{
|
||||
#[TestDox('appendParameter() succeeds for exists')]
|
||||
public function testAppendParameterSucceedsForExists(): void
|
||||
{
|
||||
$this->assertEquals([], Field::exists('exists')->appendParameter([]),
|
||||
'exists should not have appended a parameter');
|
||||
}
|
||||
|
||||
#[TestDox('Append parameter succeeds for notExists')]
|
||||
#[TestDox('appendParameter() succeeds for notExists')]
|
||||
public function testAppendParameterSucceedsForNotExists(): void
|
||||
{
|
||||
$this->assertEquals([], Field::notExists('absent')->appendParameter([]),
|
||||
'notExists should not have appended a parameter');
|
||||
}
|
||||
|
||||
#[TestDox('appendParameter() succeeds for between')]
|
||||
public function testAppendParameterSucceedsForBetween(): void
|
||||
{
|
||||
$this->assertEquals(['@nummin' => 5, '@nummax' => 9],
|
||||
Field::between('exists', 5, 9, '@num')->appendParameter([]),
|
||||
'BT should have appended min and max parameters');
|
||||
'Between should have appended min and max parameters');
|
||||
}
|
||||
|
||||
#[TestDox('appendParameter() succeeds for in')]
|
||||
public function testAppendParameterSucceedsForIn(): void
|
||||
{
|
||||
$this->assertEquals([':val_0' => 'test', ':val_1' => 'unit', ':val_2' => 'great'],
|
||||
Field::in('it', ['test', 'unit', 'great'], ':val')->appendParameter([]),
|
||||
'In should have appended 3 parameters for the input values');
|
||||
}
|
||||
|
||||
#[TestDox('appendParameter() succeeds for inArray for PostgreSQL')]
|
||||
public function testAppendParameterSucceedsForInArrayForPostgreSQL(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
try {
|
||||
$this->assertEquals([':bit_0' => '2', ':bit_1' => '8', ':bit_2' => '64'],
|
||||
Field::inArray('it', 'table', [2, 8, 64], ':bit')->appendParameter([]),
|
||||
'InArray should have appended 3 string parameters for the input values');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('appendParameter() succeeds for inArray for SQLite')]
|
||||
public function testAppendParameterSucceedsForInArrayForSQLite(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
try {
|
||||
$this->assertEquals([':bit_0' => 2, ':bit_1' => 8, ':bit_2' => 64],
|
||||
Field::inArray('it', 'table', [2, 8, 64], ':bit')->appendParameter([]),
|
||||
'InArray should have appended 3 parameters for the input values');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('appendParameter() succeeds for others')]
|
||||
public function testAppendParameterSucceedsForOthers(): void
|
||||
{
|
||||
$this->assertEquals(['@test' => 33], Field::equal('the_field', 33, '@test')->appendParameter([]),
|
||||
'Field parameter not returned correctly');
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds for exists without qualifier for PostgreSQL')]
|
||||
#[TestDox('path() succeeds for simple SQL path for PostgreSQL')]
|
||||
public function testPathSucceedsForSimpleSqlPathForPostgreSQL()
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
try {
|
||||
$this->assertEquals("data->>'it'", Field::equal('it', 'that')->path(),
|
||||
'SQL value path not generated correctly');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('path() succeeds for simple SQL path for SQLite')]
|
||||
public function testPathSucceedsForSimpleSqlPathForSQLite()
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
try {
|
||||
$this->assertEquals("data->>'top'", Field::equal('top', 'that')->path(),
|
||||
'SQL value path not generated correctly');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('path() succeeds for nested SQL path for PostgreSQL')]
|
||||
public function testPathSucceedsForNestedSqlPathForPostgreSQL()
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
try {
|
||||
$this->assertEquals("data#>>'{parts,to,the,path}'", Field::equal('parts.to.the.path', '')->path(),
|
||||
'SQL value path not generated correctly');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('path() succeeds for nested SQL path for SQLite')]
|
||||
public function testPathSucceedsForNestedSqlPathForSQLite()
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
try {
|
||||
$this->assertEquals("data->'one'->'two'->>'three'", Field::equal('one.two.three', '')->path(),
|
||||
'SQL value path not generated correctly');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('path() succeeds for simple JSON path for PostgreSQL')]
|
||||
public function testPathSucceedsForSimpleJsonPathForPostgreSQL()
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
try {
|
||||
$this->assertEquals("data->'it'", Field::equal('it', 'that')->path(true),
|
||||
'JSON value path not generated correctly');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('path() succeeds for simple JSON path for SQLite')]
|
||||
public function testPathSucceedsForSimpleJsonPathForSQLite()
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
try {
|
||||
$this->assertEquals("data->'top'", Field::equal('top', 'that')->path(true),
|
||||
'JSON value path not generated correctly');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('path() succeeds for nested JSON path for PostgreSQL')]
|
||||
public function testPathSucceedsForNestedJsonPathForPostgreSQL()
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
try {
|
||||
$this->assertEquals("data#>'{parts,to,the,path}'", Field::equal('parts.to.the.path', '')->path(true),
|
||||
'JSON value path not generated correctly');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('path() succeeds for nested JSON path for SQLite')]
|
||||
public function testPathSucceedsForNestedJsonPathForSQLite()
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
try {
|
||||
$this->assertEquals("data->'one'->'two'->'three'", Field::equal('one.two.three', '')->path(true),
|
||||
'SQL value path not generated correctly');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('toWhere() succeeds for exists without qualifier for PostgreSQL')]
|
||||
public function testToWhereSucceedsForExistsWithoutQualifierForPostgreSQL(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -56,7 +189,7 @@ class FieldTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds for exists without qualifier for SQLite')]
|
||||
#[TestDox('toWhere() succeeds for exists without qualifier for SQLite')]
|
||||
public function testToWhereSucceedsForExistsWithoutQualifierForSQLite(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
@@ -68,7 +201,7 @@ class FieldTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds for notExists without qualifier for PostgreSQL')]
|
||||
#[TestDox('toWhere() succeeds for notExists without qualifier for PostgreSQL')]
|
||||
public function testToWhereSucceedsForNotExistsWithoutQualifierForPostgreSQL(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -80,7 +213,7 @@ class FieldTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds for notExists without qualifier for SQLite')]
|
||||
#[TestDox('toWhere() succeeds for notExists without qualifier for SQLite')]
|
||||
public function testToWhereSucceedsForNotExistsWithoutQualifierForSQLite(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
@@ -92,7 +225,7 @@ class FieldTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds for between without qualifier for SQLite')]
|
||||
#[TestDox('toWhere() succeeds for between without qualifier for SQLite')]
|
||||
public function testToWhereSucceedsForBetweenWithoutQualifierForSQLite(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
@@ -104,7 +237,7 @@ class FieldTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds for between without qualifier for PostgreSQL with numeric range')]
|
||||
#[TestDox('toWhere() succeeds for between without qualifier for PostgreSQL with numeric range')]
|
||||
public function testToWhereSucceedsForBetweenWithoutQualifierForPostgreSQLWithNumericRange(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -116,7 +249,7 @@ class FieldTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds for between without qualifier for PostgreSQL with non-numeric range')]
|
||||
#[TestDox('toWhere() succeeds for between without qualifier for PostgreSQL with non-numeric range')]
|
||||
public function testToWhereSucceedsForBetweenWithoutQualifierForPostgreSQLWithNonNumericRange(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -129,7 +262,7 @@ class FieldTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds for between with qualifier for SQLite')]
|
||||
#[TestDox('toWhere() succeeds for between with qualifier for SQLite')]
|
||||
public function testToWhereSucceedsForBetweenWithQualifierForSQLite(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
@@ -143,7 +276,7 @@ class FieldTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds for between with qualifier for PostgreSQL with numeric range')]
|
||||
#[TestDox('toWhere() succeeds for between with qualifier for PostgreSQL with numeric range')]
|
||||
public function testToWhereSucceedsForBetweenWithQualifierForPostgreSQLWithNumericRange(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -157,7 +290,7 @@ class FieldTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds for between with qualifier for PostgreSQL with non-numeric range')]
|
||||
#[TestDox('toWhere() succeeds for between with qualifier for PostgreSQL with non-numeric range')]
|
||||
public function testToWhereSucceedsForBetweenWithQualifierForPostgreSQLWithNonNumericRange(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -171,7 +304,73 @@ class FieldTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds for others without qualifier for PostgreSQL')]
|
||||
#[TestDox('toWhere() succeeds for in for PostgreSQL with non-numeric values')]
|
||||
public function testToWhereSucceedsForInForPostgreSQLWithNonNumericValues(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
try {
|
||||
$field = Field::in('test', ['Atlanta', 'Chicago'], ':city');
|
||||
$this->assertEquals("data->>'test' IN (:city_0, :city_1)", $field->toWhere(),
|
||||
'WHERE fragment not generated correctly');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('toWhere() succeeds for in for PostgreSQL with numeric values')]
|
||||
public function testToWhereSucceedsForInForPostgreSQLWithNumericValues(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
try {
|
||||
$field = Field::in('even', [2, 4, 6], ':nbr');
|
||||
$this->assertEquals("(data->>'even')::numeric IN (:nbr_0, :nbr_1, :nbr_2)", $field->toWhere(),
|
||||
'WHERE fragment not generated correctly');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('toWhere() succeeds for in for SQLite')]
|
||||
public function testToWhereSucceedsForInForSQLite(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
try {
|
||||
$field = Field::in('test', ['Atlanta', 'Chicago'], ':city');
|
||||
$this->assertEquals("data->>'test' IN (:city_0, :city_1)", $field->toWhere(),
|
||||
'WHERE fragment not generated correctly');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('toWhere() succeeds for inArray for PostgreSQL')]
|
||||
public function testToWhereSucceedsForInArrayForPostgreSQL(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
try {
|
||||
$field = Field::inArray('even', 'tbl', [2, 4, 6, 8], ':it');
|
||||
$this->assertEquals("data->'even' ?| ARRAY[:it_0, :it_1, :it_2, :it_3]", $field->toWhere(),
|
||||
'WHERE fragment not generated correctly');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('toWhere() succeeds for inArray for SQLite')]
|
||||
public function testToWhereSucceedsForInArrayForSQLite(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
try {
|
||||
$field = Field::inArray('test', 'tbl', ['Atlanta', 'Chicago'], ':city');
|
||||
$this->assertEquals(
|
||||
"EXISTS (SELECT 1 FROM json_each(tbl.data, '\$.test') WHERE value IN (:city_0, :city_1))",
|
||||
$field->toWhere(), 'WHERE fragment not generated correctly');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('toWhere() succeeds for others without qualifier for PostgreSQL')]
|
||||
public function testToWhereSucceedsForOthersWithoutQualifierForPostgreSQL(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -183,7 +382,7 @@ class FieldTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds for others without qualifier for SQLite')]
|
||||
#[TestDox('toWhere() succeeds for others without qualifier for SQLite')]
|
||||
public function testToWhereSucceedsForOthersWithoutQualifierForSQLite(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
@@ -195,7 +394,7 @@ class FieldTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds with qualifier no parameter for PostgreSQL')]
|
||||
#[TestDox('toWhere() succeeds with qualifier no parameter for PostgreSQL')]
|
||||
public function testToWhereSucceedsWithQualifierNoParameterForPostgreSQL(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -209,7 +408,7 @@ class FieldTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds with qualifier no parameter for SQLite')]
|
||||
#[TestDox('toWhere() succeeds with qualifier no parameter for SQLite')]
|
||||
public function testToWhereSucceedsWithQualifierNoParameterForSQLite(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
@@ -223,7 +422,7 @@ class FieldTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds with qualifier and parameter for PostgreSQL')]
|
||||
#[TestDox('toWhere() succeeds with qualifier and parameter for PostgreSQL')]
|
||||
public function testToWhereSucceedsWithQualifierAndParameterForPostgreSQL(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
@@ -237,7 +436,7 @@ class FieldTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds with qualifier and parameter for SQLite')]
|
||||
#[TestDox('toWhere() succeeds with qualifier and parameter for SQLite')]
|
||||
public function testToWhereSucceedsWithQualifierAndParameterForSQLite(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
@@ -251,33 +450,7 @@ class FieldTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds with sub-document for PostgreSQL')]
|
||||
public function testToWhereSucceedsWithSubDocumentForPostgreSQL(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
try {
|
||||
$field = Field::equal('sub.foo.bar', 22, '@it');
|
||||
$this->assertEquals("(data#>>'{sub,foo,bar}')::numeric = @it", $field->toWhere(),
|
||||
'WHERE fragment not generated correctly');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('To where succeeds with sub-document for SQLite')]
|
||||
public function testToWhereSucceedsWithSubDocumentForSQLite(): void
|
||||
{
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
try {
|
||||
$field = Field::equal('sub.foo.bar', 22, '@it');
|
||||
$this->assertEquals("data->>'sub'->>'foo'->>'bar' = @it", $field->toWhere(),
|
||||
'WHERE fragment not generated correctly');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('equal succeeds without parameter')]
|
||||
#[TestDox('equal() succeeds without parameter')]
|
||||
public function testEqualSucceedsWithoutParameter(): void
|
||||
{
|
||||
$field = Field::equal('my_test', 9);
|
||||
@@ -288,7 +461,7 @@ class FieldTest extends TestCase
|
||||
$this->assertEquals('', $field->paramName, 'Parameter name should have been blank');
|
||||
}
|
||||
|
||||
#[TestDox('equal succeeds with parameter')]
|
||||
#[TestDox('equal() succeeds with parameter')]
|
||||
public function testEqualSucceedsWithParameter(): void
|
||||
{
|
||||
$field = Field::equal('another_test', 'turkey', '@test');
|
||||
@@ -299,7 +472,7 @@ class FieldTest extends TestCase
|
||||
$this->assertEquals('@test', $field->paramName, 'Parameter name not filled correctly');
|
||||
}
|
||||
|
||||
#[TestDox('greater succeeds without parameter')]
|
||||
#[TestDox('greater() succeeds without parameter')]
|
||||
public function testGreaterSucceedsWithoutParameter(): void
|
||||
{
|
||||
$field = Field::greater('your_test', 4);
|
||||
@@ -310,7 +483,7 @@ class FieldTest extends TestCase
|
||||
$this->assertEquals('', $field->paramName, 'Parameter name should have been blank');
|
||||
}
|
||||
|
||||
#[TestDox('greater succeeds with parameter')]
|
||||
#[TestDox('greater() succeeds with parameter')]
|
||||
public function testGreaterSucceedsWithParameter(): void
|
||||
{
|
||||
$field = Field::greater('more_test', 'chicken', '@value');
|
||||
@@ -321,7 +494,7 @@ class FieldTest extends TestCase
|
||||
$this->assertEquals('@value', $field->paramName, 'Parameter name not filled correctly');
|
||||
}
|
||||
|
||||
#[TestDox('greaterOrEqual succeeds without parameter')]
|
||||
#[TestDox('greaterOrEqual() succeeds without parameter')]
|
||||
public function testGreaterOrEqualSucceedsWithoutParameter(): void
|
||||
{
|
||||
$field = Field::greaterOrEqual('their_test', 6);
|
||||
@@ -332,7 +505,7 @@ class FieldTest extends TestCase
|
||||
$this->assertEquals('', $field->paramName, 'Parameter name should have been blank');
|
||||
}
|
||||
|
||||
#[TestDox('greaterOrEqual succeeds with parameter')]
|
||||
#[TestDox('greaterOrEqual() succeeds with parameter')]
|
||||
public function testGreaterOrEqualSucceedsWithParameter(): void
|
||||
{
|
||||
$field = Field::greaterOrEqual('greater_test', 'poultry', '@cluck');
|
||||
@@ -343,7 +516,7 @@ class FieldTest extends TestCase
|
||||
$this->assertEquals('@cluck', $field->paramName, 'Parameter name not filled correctly');
|
||||
}
|
||||
|
||||
#[TestDox('less succeeds without parameter')]
|
||||
#[TestDox('less() succeeds without parameter')]
|
||||
public function testLessSucceedsWithoutParameter(): void
|
||||
{
|
||||
$field = Field::less('z', 32);
|
||||
@@ -354,7 +527,7 @@ class FieldTest extends TestCase
|
||||
$this->assertEquals('', $field->paramName, 'Parameter name should have been blank');
|
||||
}
|
||||
|
||||
#[TestDox('less succeeds with parameter')]
|
||||
#[TestDox('less() succeeds with parameter')]
|
||||
public function testLessSucceedsWithParameter(): void
|
||||
{
|
||||
$field = Field::less('additional_test', 'fowl', '@boo');
|
||||
@@ -365,7 +538,7 @@ class FieldTest extends TestCase
|
||||
$this->assertEquals('@boo', $field->paramName, 'Parameter name not filled correctly');
|
||||
}
|
||||
|
||||
#[TestDox('lessOrEqual succeeds without parameter')]
|
||||
#[TestDox('lessOrEqual() succeeds without parameter')]
|
||||
public function testLessOrEqualSucceedsWithoutParameter(): void
|
||||
{
|
||||
$field = Field::lessOrEqual('g', 87);
|
||||
@@ -376,7 +549,7 @@ class FieldTest extends TestCase
|
||||
$this->assertEquals('', $field->paramName, 'Parameter name should have been blank');
|
||||
}
|
||||
|
||||
#[TestDox('lessOrEqual succeeds with parameter')]
|
||||
#[TestDox('lessOrEqual() succeeds with parameter')]
|
||||
public function testLessOrEqualSucceedsWithParameter(): void
|
||||
{
|
||||
$field = Field::lessOrEqual('lesser_test', 'hen', '@woo');
|
||||
@@ -387,7 +560,7 @@ class FieldTest extends TestCase
|
||||
$this->assertEquals('@woo', $field->paramName, 'Parameter name not filled correctly');
|
||||
}
|
||||
|
||||
#[TestDox('notEqual succeeds without parameter')]
|
||||
#[TestDox('notEqual() succeeds without parameter')]
|
||||
public function testNotEqualSucceedsWithoutParameter(): void
|
||||
{
|
||||
$field = Field::notEqual('j', 65);
|
||||
@@ -398,7 +571,7 @@ class FieldTest extends TestCase
|
||||
$this->assertEquals('', $field->paramName, 'Parameter name should have been blank');
|
||||
}
|
||||
|
||||
#[TestDox('notEqual succeeds with parameter')]
|
||||
#[TestDox('notEqual() succeeds with parameter')]
|
||||
public function testNotEqualSucceedsWithParameter(): void
|
||||
{
|
||||
$field = Field::notEqual('unequal_test', 'egg', '@zoo');
|
||||
@@ -409,7 +582,7 @@ class FieldTest extends TestCase
|
||||
$this->assertEquals('@zoo', $field->paramName, 'Parameter name not filled correctly');
|
||||
}
|
||||
|
||||
#[TestDox('between succeeds without parameter')]
|
||||
#[TestDox('between() succeeds without parameter')]
|
||||
public function testBetweenSucceedsWithoutParameter(): void
|
||||
{
|
||||
$field = Field::between('k', 'alpha', 'zed');
|
||||
@@ -420,7 +593,7 @@ class FieldTest extends TestCase
|
||||
$this->assertEquals('', $field->paramName, 'Parameter name should have been blank');
|
||||
}
|
||||
|
||||
#[TestDox('between succeeds with parameter')]
|
||||
#[TestDox('between() succeeds with parameter')]
|
||||
public function testBetweenSucceedsWithParameter(): void
|
||||
{
|
||||
$field = Field::between('between_test', 18, 49, '@count');
|
||||
@@ -431,7 +604,51 @@ class FieldTest extends TestCase
|
||||
$this->assertEquals('@count', $field->paramName, 'Parameter name not filled correctly');
|
||||
}
|
||||
|
||||
#[TestDox('exists succeeds')]
|
||||
#[TestDox('in() succeeds without parameter')]
|
||||
public function testInSucceedsWithoutParameter(): void
|
||||
{
|
||||
$field = Field::in('test', [1, 2, 3]);
|
||||
$this->assertNotNull($field, 'The field should not have been null');
|
||||
$this->assertEquals('test', $field->fieldName, 'Field name not filled correctly');
|
||||
$this->assertEquals(Op::In, $field->op, 'Operation not filled correctly');
|
||||
$this->assertEquals([1, 2, 3], $field->value, 'Value not filled correctly');
|
||||
$this->assertEquals('', $field->paramName, 'Parameter name should have been blank');
|
||||
}
|
||||
|
||||
#[TestDox('in() succeeds with parameter')]
|
||||
public function testInSucceedsWithParameter(): void
|
||||
{
|
||||
$field = Field::in('unit', ['a', 'b'], '@inParam');
|
||||
$this->assertNotNull($field, 'The field should not have been null');
|
||||
$this->assertEquals('unit', $field->fieldName, 'Field name not filled correctly');
|
||||
$this->assertEquals(Op::In, $field->op, 'Operation not filled correctly');
|
||||
$this->assertEquals(['a', 'b'], $field->value, 'Value not filled correctly');
|
||||
$this->assertEquals('@inParam', $field->paramName, 'Parameter name not filled correctly');
|
||||
}
|
||||
|
||||
#[TestDox('inArray() succeeds without parameter')]
|
||||
public function testInArraySucceedsWithoutParameter(): void
|
||||
{
|
||||
$field = Field::inArray('test', 'tbl', [1, 2, 3]);
|
||||
$this->assertNotNull($field, 'The field should not have been null');
|
||||
$this->assertEquals('test', $field->fieldName, 'Field name not filled correctly');
|
||||
$this->assertEquals(Op::InArray, $field->op, 'Operation not filled correctly');
|
||||
$this->assertEquals(['table' => 'tbl', 'values' => [1, 2, 3]], $field->value, 'Value not filled correctly');
|
||||
$this->assertEquals('', $field->paramName, 'Parameter name should have been blank');
|
||||
}
|
||||
|
||||
#[TestDox('inArray() succeeds with parameter')]
|
||||
public function testInArraySucceedsWithParameter(): void
|
||||
{
|
||||
$field = Field::inArray('unit', 'tab', ['a', 'b'], '@inAParam');
|
||||
$this->assertNotNull($field, 'The field should not have been null');
|
||||
$this->assertEquals('unit', $field->fieldName, 'Field name not filled correctly');
|
||||
$this->assertEquals(Op::InArray, $field->op, 'Operation not filled correctly');
|
||||
$this->assertEquals(['table' => 'tab', 'values' => ['a', 'b']], $field->value, 'Value not filled correctly');
|
||||
$this->assertEquals('@inAParam', $field->paramName, 'Parameter name not filled correctly');
|
||||
}
|
||||
|
||||
#[TestDox('exists() succeeds')]
|
||||
public function testExistsSucceeds(): void
|
||||
{
|
||||
$field = Field::exists('be_there');
|
||||
@@ -442,7 +659,7 @@ class FieldTest extends TestCase
|
||||
$this->assertEquals('', $field->paramName, 'Parameter name should have been blank');
|
||||
}
|
||||
|
||||
#[TestDox('notExists succeeds')]
|
||||
#[TestDox('notExists() succeeds')]
|
||||
public function testNotExistsSucceeds(): void
|
||||
{
|
||||
$field = Field::notExists('be_absent');
|
||||
|
||||
Reference in New Issue
Block a user