Changes for beta10 #5
|
@ -18,6 +18,7 @@ use PHPUnit\Framework\TestCase;
|
||||||
#[TestDox('Array Mapper (Unit tests)')]
|
#[TestDox('Array Mapper (Unit tests)')]
|
||||||
class ArrayMapperTest extends TestCase
|
class ArrayMapperTest extends TestCase
|
||||||
{
|
{
|
||||||
|
#[TestDox('map() succeeds')]
|
||||||
public function testMapSucceeds(): void
|
public function testMapSucceeds(): void
|
||||||
{
|
{
|
||||||
$result = ['one' => 2, 'three' => 4, 'eight' => 'five'];
|
$result = ['one' => 2, 'three' => 4, 'eight' => 'five'];
|
||||||
|
|
|
@ -18,6 +18,7 @@ use PHPUnit\Framework\TestCase;
|
||||||
#[TestDox('Count Mapper (Unit tests)')]
|
#[TestDox('Count Mapper (Unit tests)')]
|
||||||
class CountMapperTest extends TestCase
|
class CountMapperTest extends TestCase
|
||||||
{
|
{
|
||||||
|
#[TestDox('map() succeeds')]
|
||||||
public function testMapSucceeds(): void
|
public function testMapSucceeds(): void
|
||||||
{
|
{
|
||||||
$this->assertEquals(5, (new CountMapper())->map([5, 8, 10]), 'Count not correct');
|
$this->assertEquals(5, (new CountMapper())->map([5, 8, 10]), 'Count not correct');
|
||||||
|
|
|
@ -44,7 +44,7 @@ class DocumentMapperTest extends TestCase
|
||||||
$this->assertEquals('json', $mapper->fieldName, 'Field name not recorded correctly');
|
$this->assertEquals('json', $mapper->fieldName, 'Field name not recorded correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('Map succeeds with valid JSON')]
|
#[TestDox('map() succeeds with valid JSON')]
|
||||||
public function testMapSucceedsWithValidJSON(): void
|
public function testMapSucceedsWithValidJSON(): void
|
||||||
{
|
{
|
||||||
$doc = (new DocumentMapper(TestDocument::class))->map(['data' => '{"id":7,"subDoc":{"id":22,"name":"tester"}}']);
|
$doc = (new DocumentMapper(TestDocument::class))->map(['data' => '{"id":7,"subDoc":{"id":22,"name":"tester"}}']);
|
||||||
|
@ -55,7 +55,7 @@ class DocumentMapperTest extends TestCase
|
||||||
$this->assertEquals('tester', $doc->subDoc->name, 'Sub-document name not filled correctly');
|
$this->assertEquals('tester', $doc->subDoc->name, 'Sub-document name not filled correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('Map succeeds with valid JSON for pjson class')]
|
#[TestDox('map() succeeds with valid JSON for Pjson class')]
|
||||||
public function testMapSucceedsWithValidJSONForPjsonClass(): void
|
public function testMapSucceedsWithValidJSONForPjsonClass(): void
|
||||||
{
|
{
|
||||||
$doc = (new DocumentMapper(PjsonDocument::class))->map(['data' => '{"id":"seven","name":"bob","num_value":8}']);
|
$doc = (new DocumentMapper(PjsonDocument::class))->map(['data' => '{"id":"seven","name":"bob","num_value":8}']);
|
||||||
|
@ -66,14 +66,14 @@ class DocumentMapperTest extends TestCase
|
||||||
$this->assertFalse(isset($doc->skipped), 'Non-JSON field has not been set');
|
$this->assertFalse(isset($doc->skipped), 'Non-JSON field has not been set');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('Map fails with invalid JSON')]
|
#[TestDox('map() fails with invalid JSON')]
|
||||||
public function testMapFailsWithInvalidJSON(): void
|
public function testMapFailsWithInvalidJSON(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
(new DocumentMapper(TestDocument::class))->map(['data' => 'this is not valid']);
|
(new DocumentMapper(TestDocument::class))->map(['data' => 'this is not valid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('Map fails with invalid JSON for pjson class')]
|
#[TestDox('map() fails with invalid JSON for Pjson class')]
|
||||||
public function testMapFailsWithInvalidJSONForPjsonClass(): void
|
public function testMapFailsWithInvalidJSONForPjsonClass(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
|
|
|
@ -19,7 +19,7 @@ use PHPUnit\Framework\TestCase;
|
||||||
#[TestDox('Exists Mapper (Unit tests)')]
|
#[TestDox('Exists Mapper (Unit tests)')]
|
||||||
class ExistsMapperTest extends TestCase
|
class ExistsMapperTest extends TestCase
|
||||||
{
|
{
|
||||||
#[TestDox('Map succeeds for PostgreSQL')]
|
#[TestDox('map() succeeds for PostgreSQL')]
|
||||||
public function testMapSucceedsForPostgreSQL(): void
|
public function testMapSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
@ -30,7 +30,7 @@ class ExistsMapperTest extends TestCase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('Map succeeds for SQLite')]
|
#[TestDox('map() succeeds for SQLite')]
|
||||||
public function testMapSucceedsForSQLite(): void
|
public function testMapSucceedsForSQLite(): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
@ -41,6 +41,7 @@ class ExistsMapperTest extends TestCase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('map() fails when mode not set')]
|
||||||
public function testMapFailsWhenModeNotSet(): void
|
public function testMapFailsWhenModeNotSet(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
|
|
|
@ -18,6 +18,7 @@ use PHPUnit\Framework\TestCase;
|
||||||
#[TestDox('String Mapper (Unit tests)')]
|
#[TestDox('String Mapper (Unit tests)')]
|
||||||
class StringMapperTest extends TestCase
|
class StringMapperTest extends TestCase
|
||||||
{
|
{
|
||||||
|
#[TestDox('map() succeeds when field is present and string')]
|
||||||
public function testMapSucceedsWhenFieldIsPresentAndString(): void
|
public function testMapSucceedsWhenFieldIsPresentAndString(): void
|
||||||
{
|
{
|
||||||
$result = ['test_field' => 'test_value'];
|
$result = ['test_field' => 'test_value'];
|
||||||
|
@ -25,6 +26,7 @@ class StringMapperTest extends TestCase
|
||||||
$this->assertEquals('test_value', $mapper->map($result), 'String value not returned correctly');
|
$this->assertEquals('test_value', $mapper->map($result), 'String value not returned correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('map() succeeds when field is present and not string')]
|
||||||
public function testMapSucceedsWhenFieldIsPresentAndNotString(): void
|
public function testMapSucceedsWhenFieldIsPresentAndNotString(): void
|
||||||
{
|
{
|
||||||
$result = ['a_number' => 6.7];
|
$result = ['a_number' => 6.7];
|
||||||
|
@ -32,6 +34,7 @@ class StringMapperTest extends TestCase
|
||||||
$this->assertEquals('6.7', $mapper->map($result), 'Number value not returned correctly');
|
$this->assertEquals('6.7', $mapper->map($result), 'Number value not returned correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('map() succeeds when field is not present')]
|
||||||
public function testMapSucceedsWhenFieldIsNotPresent(): void
|
public function testMapSucceedsWhenFieldIsNotPresent(): void
|
||||||
{
|
{
|
||||||
$mapper = new StringMapper('something_else');
|
$mapper = new StringMapper('something_else');
|
||||||
|
|
|
@ -25,12 +25,14 @@ class CountTest extends TestCase
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('all() succeeds')]
|
||||||
public function testAllSucceeds(): void
|
public function testAllSucceeds(): void
|
||||||
{
|
{
|
||||||
$this->assertEquals('SELECT COUNT(*) FROM a_table', Count::all('a_table'),
|
$this->assertEquals('SELECT COUNT(*) FROM a_table', Count::all('a_table'),
|
||||||
'SELECT statement not generated correctly');
|
'SELECT statement not generated correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('byFields() succeeds')]
|
||||||
public function testByFieldsSucceeds(): void
|
public function testByFieldsSucceeds(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::SQLite);
|
Configuration::overrideMode(Mode::SQLite);
|
||||||
|
@ -39,7 +41,7 @@ class CountTest extends TestCase
|
||||||
'SELECT statement not generated correctly');
|
'SELECT statement not generated correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By contains succeeds for PostgreSQL')]
|
#[TestDox('byContains() succeeds for PostgreSQL')]
|
||||||
public function testByContainsSucceedsForPostgreSQL(): void
|
public function testByContainsSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -47,14 +49,14 @@ class CountTest extends TestCase
|
||||||
'SELECT statement not generated correctly');
|
'SELECT statement not generated correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By contains fails for non PostgreSQL')]
|
#[TestDox('byContains() fails for non PostgreSQL')]
|
||||||
public function testByContainsFailsForNonPostgreSQL(): void
|
public function testByContainsFailsForNonPostgreSQL(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
Count::byContains('');
|
Count::byContains('');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By JSON Path succeeds for PostgreSQL')]
|
#[TestDox('byJsonPath() succeeds for PostgreSQL')]
|
||||||
public function testByJsonPathSucceedsForPostgreSQL(): void
|
public function testByJsonPathSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -62,7 +64,7 @@ class CountTest extends TestCase
|
||||||
Count::byJsonPath('a_table'), 'SELECT statement not generated correctly');
|
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
|
public function testByJsonPathFailsForNonPostgreSQL(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
|
|
|
@ -25,7 +25,7 @@ class DefinitionTest extends TestCase
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('Ensure table succeeds for PosgtreSQL')]
|
#[TestDox('ensureTable() succeeds for PosgtreSQL')]
|
||||||
public function testEnsureTableSucceedsForPostgreSQL(): void
|
public function testEnsureTableSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -33,7 +33,7 @@ class DefinitionTest extends TestCase
|
||||||
Definition::ensureTable('documents'), 'CREATE TABLE statement not generated correctly');
|
Definition::ensureTable('documents'), 'CREATE TABLE statement not generated correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('Ensure table succeeds for SQLite')]
|
#[TestDox('ensureTable() succeeds for SQLite')]
|
||||||
public function testEnsureTableSucceedsForSQLite(): void
|
public function testEnsureTableSucceedsForSQLite(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::SQLite);
|
Configuration::overrideMode(Mode::SQLite);
|
||||||
|
@ -41,18 +41,21 @@ class DefinitionTest extends TestCase
|
||||||
'CREATE TABLE statement not generated correctly');
|
'CREATE TABLE statement not generated correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('ensureTable() fails when mode not set')]
|
||||||
public function testEnsureTableFailsWhenModeNotSet(): void
|
public function testEnsureTableFailsWhenModeNotSet(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
Definition::ensureTable('boom');
|
Definition::ensureTable('boom');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('ensureIndexOn() succeeds without schema single ascending field')]
|
||||||
public function testEnsureIndexOnSucceedsWithoutSchemaSingleAscendingField(): void
|
public function testEnsureIndexOnSucceedsWithoutSchemaSingleAscendingField(): void
|
||||||
{
|
{
|
||||||
$this->assertEquals("CREATE INDEX IF NOT EXISTS idx_test_fields ON test ((data->>'details'))",
|
$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');
|
Definition::ensureIndexOn('test', 'fields', ['details']), 'CREATE INDEX statement not generated correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('ensureIndexOn() succeeds with schema multiple fields')]
|
||||||
public function testEnsureIndexOnSucceedsWithSchemaMultipleFields(): void
|
public function testEnsureIndexOnSucceedsWithSchemaMultipleFields(): void
|
||||||
{
|
{
|
||||||
$this->assertEquals(
|
$this->assertEquals(
|
||||||
|
@ -61,12 +64,14 @@ class DefinitionTest extends TestCase
|
||||||
'CREATE INDEX statement not generated correctly');
|
'CREATE INDEX statement not generated correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('ensureKey() succeeds')]
|
||||||
public function testEnsureKeySucceeds(): void
|
public function testEnsureKeySucceeds(): void
|
||||||
{
|
{
|
||||||
$this->assertEquals("CREATE UNIQUE INDEX IF NOT EXISTS idx_tbl_key ON tbl ((data->>'id'))",
|
$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');
|
Definition::ensureKey('tbl'), 'CREATE INDEX statement for document key not generated correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('ensureDocumentIndexOn() succeeds for schema and Full')]
|
||||||
public function testEnsureDocumentIndexOnSucceedsForSchemaAndFull(): void
|
public function testEnsureDocumentIndexOnSucceedsForSchemaAndFull(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -74,6 +79,7 @@ class DefinitionTest extends TestCase
|
||||||
Definition::ensureDocumentIndexOn('my.tbl', DocumentIndex::Full));
|
Definition::ensureDocumentIndexOn('my.tbl', DocumentIndex::Full));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('ensureDocumentIndexOn() succeeds for no schema and Optimized')]
|
||||||
public function testEnsureDocumentIndexOnSucceedsForNoSchemaAndOptimized(): void
|
public function testEnsureDocumentIndexOnSucceedsForNoSchemaAndOptimized(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -81,7 +87,7 @@ class DefinitionTest extends TestCase
|
||||||
Definition::ensureDocumentIndexOn('it', DocumentIndex::Optimized));
|
Definition::ensureDocumentIndexOn('it', DocumentIndex::Optimized));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('Ensure document index on fails for non PostgreSQL')]
|
#[TestDox('ensureDocumentIndexOn() fails for non PostgreSQL')]
|
||||||
public function testEnsureDocumentIndexOnFailsForNonPostgreSQL(): void
|
public function testEnsureDocumentIndexOnFailsForNonPostgreSQL(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
|
|
|
@ -24,7 +24,7 @@ class DeleteTest extends TestCase
|
||||||
Configuration::overrideMode(null);
|
Configuration::overrideMode(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By ID succeeds')]
|
#[TestDox('byId() succeeds')]
|
||||||
public function testByIdSucceeds(): void
|
public function testByIdSucceeds(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::SQLite);
|
Configuration::overrideMode(Mode::SQLite);
|
||||||
|
@ -32,6 +32,7 @@ class DeleteTest extends TestCase
|
||||||
'DELETE statement not constructed correctly');
|
'DELETE statement not constructed correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('byFields() succeeds')]
|
||||||
public function testByFieldsSucceeds(): void
|
public function testByFieldsSucceeds(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::SQLite);
|
Configuration::overrideMode(Mode::SQLite);
|
||||||
|
@ -41,7 +42,7 @@ class DeleteTest extends TestCase
|
||||||
'DELETE statement not constructed correctly');
|
'DELETE statement not constructed correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By contains succeeds for PostgreSQL')]
|
#[TestDox('byContains() succeeds for PostgreSQL')]
|
||||||
public function testByContainsSucceedsForPostgreSQL(): void
|
public function testByContainsSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -49,14 +50,14 @@ class DeleteTest extends TestCase
|
||||||
'DELETE statement not constructed correctly');
|
'DELETE statement not constructed correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By contains fails for non PostgreSQL')]
|
#[TestDox('byContains() fails for non PostgreSQL')]
|
||||||
public function testByContainsFailsForNonPostgreSQL(): void
|
public function testByContainsFailsForNonPostgreSQL(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
Delete::byContains('');
|
Delete::byContains('');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By JSON Path succeeds for PostgreSQL')]
|
#[TestDox('byJsonPath() succeeds for PostgreSQL')]
|
||||||
public function testByJsonPathSucceedsForPostgreSQL(): void
|
public function testByJsonPathSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -64,7 +65,7 @@ class DeleteTest extends TestCase
|
||||||
Delete::byJsonPath('here'), 'DELETE statement not constructed correctly');
|
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
|
public function testByJsonPathFailsForNonPostgreSQL(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
|
|
|
@ -24,6 +24,7 @@ class ExistsTest extends TestCase
|
||||||
Configuration::overrideMode(null);
|
Configuration::overrideMode(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('query() succeeds')]
|
||||||
public function testQuerySucceeds(): void
|
public function testQuerySucceeds(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::SQLite);
|
Configuration::overrideMode(Mode::SQLite);
|
||||||
|
@ -31,7 +32,7 @@ class ExistsTest extends TestCase
|
||||||
'Existence query not generated correctly');
|
'Existence query not generated correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By ID succeeds')]
|
#[TestDox('byId() succeeds')]
|
||||||
public function testByIdSucceeds(): void
|
public function testByIdSucceeds(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::SQLite);
|
Configuration::overrideMode(Mode::SQLite);
|
||||||
|
@ -39,6 +40,7 @@ class ExistsTest extends TestCase
|
||||||
'Existence query not generated correctly');
|
'Existence query not generated correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('byFields() succeeds')]
|
||||||
public function testByFieldsSucceeds(): void
|
public function testByFieldsSucceeds(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::SQLite);
|
Configuration::overrideMode(Mode::SQLite);
|
||||||
|
@ -47,7 +49,7 @@ class ExistsTest extends TestCase
|
||||||
'Existence query not generated correctly');
|
'Existence query not generated correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By contains succeeds for PostgreSQL')]
|
#[TestDox('byContains() succeeds for PostgreSQL')]
|
||||||
public function testByContainsSucceedsForPostgreSQL(): void
|
public function testByContainsSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -55,14 +57,14 @@ class ExistsTest extends TestCase
|
||||||
Exists::byContains('pocket'), 'Existence query not generated correctly');
|
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
|
public function testByContainsFailsForNonPostgreSQL(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
Exists::byContains('');
|
Exists::byContains('');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By JSON Path succeeds for PostgreSQL')]
|
#[TestDox('byJsonPath() succeeds for PostgreSQL')]
|
||||||
public function testByJsonPathSucceedsForPostgreSQL(): void
|
public function testByJsonPathSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -70,7 +72,7 @@ class ExistsTest extends TestCase
|
||||||
Exists::byJsonPath('lint'), 'Existence query not generated correctly');
|
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
|
public function testByJsonPathFailsForNonPostgreSQL(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
|
|
|
@ -24,7 +24,7 @@ class FindTest extends TestCase
|
||||||
Configuration::overrideMode(null);
|
Configuration::overrideMode(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By ID succeeds')]
|
#[TestDox('byId() succeeds')]
|
||||||
public function testByIdSucceeds(): void
|
public function testByIdSucceeds(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::SQLite);
|
Configuration::overrideMode(Mode::SQLite);
|
||||||
|
@ -32,6 +32,7 @@ class FindTest extends TestCase
|
||||||
'SELECT query not generated correctly');
|
'SELECT query not generated correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('byFields() succeeds')]
|
||||||
public function testByFieldsSucceeds(): void
|
public function testByFieldsSucceeds(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::SQLite);
|
Configuration::overrideMode(Mode::SQLite);
|
||||||
|
@ -41,7 +42,7 @@ class FindTest extends TestCase
|
||||||
'SELECT query not generated correctly');
|
'SELECT query not generated correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By contains succeeds for PostgreSQL')]
|
#[TestDox('byContains() succeeds for PostgreSQL')]
|
||||||
public function testByContainsSucceedsForPostgreSQL(): void
|
public function testByContainsSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -49,14 +50,14 @@ class FindTest extends TestCase
|
||||||
'SELECT query not generated correctly');
|
'SELECT query not generated correctly');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By contains fails for non PostgreSQL')]
|
#[TestDox('byContains() fails for non PostgreSQL')]
|
||||||
public function testByContainsFailsForNonPostgreSQL(): void
|
public function testByContainsFailsForNonPostgreSQL(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
Find::byContains('');
|
Find::byContains('');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By JSON Path succeeds for PostgreSQL')]
|
#[TestDox('byJsonPath() succeeds for PostgreSQL')]
|
||||||
public function testByJsonPathSucceedsForPostgreSQL(): void
|
public function testByJsonPathSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -64,7 +65,7 @@ class FindTest extends TestCase
|
||||||
Find::byJsonPath('light'), 'SELECT query not generated correctly');
|
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
|
public function testByJsonPathFailsForNonPostgreSQL(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
|
|
|
@ -24,7 +24,7 @@ class PatchTest extends TestCase
|
||||||
Configuration::overrideMode(null);
|
Configuration::overrideMode(null);
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
#[TestDox('By ID succeeds for PostgreSQL')]
|
#[TestDox('byId() succeeds for PostgreSQL')]
|
||||||
public function testByIdSucceedsForPostgreSQL(): void
|
public function testByIdSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -32,7 +32,7 @@ class PatchTest extends TestCase
|
||||||
Patch::byId('doc_table'), 'Patch UPDATE statement is not correct');
|
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
|
public function testByIdSucceedsForSQLite(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::SQLite);
|
Configuration::overrideMode(Mode::SQLite);
|
||||||
|
@ -40,14 +40,14 @@ class PatchTest extends TestCase
|
||||||
Patch::byId('my_table'), 'Patch UPDATE statement is not correct');
|
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
|
public function testByIdFailsWhenModeNotSet(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
Patch::byId('oof');
|
Patch::byId('oof');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By fields succeeds for PostgreSQL')]
|
#[TestDox('byFields() succeeds for PostgreSQL')]
|
||||||
public function testByFieldsSucceedsForPostgreSQL(): void
|
public function testByFieldsSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -55,7 +55,7 @@ class PatchTest extends TestCase
|
||||||
Patch::byFields('that', [Field::less('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
|
public function testByFieldsSucceedsForSQLite(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::SQLite);
|
Configuration::overrideMode(Mode::SQLite);
|
||||||
|
@ -65,13 +65,14 @@ class PatchTest extends TestCase
|
||||||
'Patch UPDATE statement is not correct');
|
'Patch UPDATE statement is not correct');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('byFields() fails when mode not set')]
|
||||||
public function testByFieldsFailsWhenModeNotSet(): void
|
public function testByFieldsFailsWhenModeNotSet(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
Patch::byFields('oops', []);
|
Patch::byFields('oops', []);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By contains succeeds for PostgreSQL')]
|
#[TestDox('byContains() succeeds for PostgreSQL')]
|
||||||
public function testByContainsSucceedsForPostgreSQL(): void
|
public function testByContainsSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -79,14 +80,14 @@ class PatchTest extends TestCase
|
||||||
'Patch UPDATE statement is not correct');
|
'Patch UPDATE statement is not correct');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By contains fails for non PostgreSQL')]
|
#[TestDox('byContains() fails for non PostgreSQL')]
|
||||||
public function testByContainsFailsForNonPostgreSQL(): void
|
public function testByContainsFailsForNonPostgreSQL(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
Patch::byContains('');
|
Patch::byContains('');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By JSON Path succeeds for PostgreSQL')]
|
#[TestDox('byJsonPath() succeeds for PostgreSQL')]
|
||||||
public function testByJsonPathSucceedsForPostgreSQL(): void
|
public function testByJsonPathSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -94,7 +95,7 @@ class PatchTest extends TestCase
|
||||||
Patch::byJsonPath('that'), 'Patch UPDATE statement is not correct');
|
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
|
public function testByJsonPathFailsForNonPostgreSQL(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
|
|
|
@ -24,7 +24,7 @@ class RemoveFieldsTest extends TestCase
|
||||||
Configuration::overrideMode(null);
|
Configuration::overrideMode(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('Update succeeds for PostgreSQL')]
|
#[TestDox('update() succeeds for PostgreSQL')]
|
||||||
public function testUpdateSucceedsForPostgreSQL(): void
|
public function testUpdateSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -32,7 +32,7 @@ class RemoveFieldsTest extends TestCase
|
||||||
RemoveFields::update('taco', [':names' => "{one,two}"], 'it = true'), 'UPDATE statement not correct');
|
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
|
public function testUpdateSucceedsForSQLite(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::SQLite);
|
Configuration::overrideMode(Mode::SQLite);
|
||||||
|
@ -41,13 +41,14 @@ class RemoveFieldsTest extends TestCase
|
||||||
'UPDATE statement not correct');
|
'UPDATE statement not correct');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('update() fails when mode not set')]
|
||||||
public function testUpdateFailsWhenModeNotSet(): void
|
public function testUpdateFailsWhenModeNotSet(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
RemoveFields::update('wow', [], '');
|
RemoveFields::update('wow', [], '');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By ID succeeds for PostgreSQL')]
|
#[TestDox('byId() succeeds for PostgreSQL')]
|
||||||
public function testByIdSucceedsForPostgreSQL(): void
|
public function testByIdSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -55,7 +56,7 @@ class RemoveFieldsTest extends TestCase
|
||||||
RemoveFields::byId('churro', Parameters::fieldNames(':bite', ['byte'])), 'UPDATE statement not correct');
|
RemoveFields::byId('churro', Parameters::fieldNames(':bite', ['byte'])), 'UPDATE statement not correct');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By ID succeeds for SQLite')]
|
#[TestDox('byId() succeeds for SQLite')]
|
||||||
public function testByIdSucceedsForSQLite(): void
|
public function testByIdSucceedsForSQLite(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::SQLite);
|
Configuration::overrideMode(Mode::SQLite);
|
||||||
|
@ -64,14 +65,14 @@ class RemoveFieldsTest extends TestCase
|
||||||
'UPDATE statement not correct');
|
'UPDATE statement not correct');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By ID fails when mode not set')]
|
#[TestDox('byId() fails when mode not set')]
|
||||||
public function testByIdFailsWhenModeNotSet(): void
|
public function testByIdFailsWhenModeNotSet(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
RemoveFields::byId('oof', []);
|
RemoveFields::byId('oof', []);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By fields succeeds for PostgreSQL')]
|
#[TestDox('byFields() succeeds for PostgreSQL')]
|
||||||
public function testByFieldsSucceedsForPostgreSQL(): void
|
public function testByFieldsSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -81,7 +82,7 @@ class RemoveFieldsTest extends TestCase
|
||||||
'UPDATE statement not correct');
|
'UPDATE statement not correct');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By fields succeeds for SQLite')]
|
#[TestDox('byFields() succeeds for SQLite')]
|
||||||
public function testByFieldsSucceedsForSQLite(): void
|
public function testByFieldsSucceedsForSQLite(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::SQLite);
|
Configuration::overrideMode(Mode::SQLite);
|
||||||
|
@ -92,13 +93,14 @@ class RemoveFieldsTest extends TestCase
|
||||||
'UPDATE statement not correct');
|
'UPDATE statement not correct');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[TestDox('byFields() fails when mode not set')]
|
||||||
public function testByFieldsFailsWhenModeNotSet(): void
|
public function testByFieldsFailsWhenModeNotSet(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
RemoveFields::byFields('boing', [], []);
|
RemoveFields::byFields('boing', [], []);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By contains succeeds for PostgreSQL')]
|
#[TestDox('byContains() succeeds for PostgreSQL')]
|
||||||
public function testByContainsSucceedsForPostgreSQL(): void
|
public function testByContainsSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -107,14 +109,14 @@ class RemoveFieldsTest extends TestCase
|
||||||
'UPDATE statement not correct');
|
'UPDATE statement not correct');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By contains fails for non PostgreSQL')]
|
#[TestDox('byContains() fails for non PostgreSQL')]
|
||||||
public function testByContainsFailsForNonPostgreSQL(): void
|
public function testByContainsFailsForNonPostgreSQL(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
RemoveFields::byContains('', []);
|
RemoveFields::byContains('', []);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By JSON Path succeeds for PostgreSQL')]
|
#[TestDox('byJsonPath() succeeds for PostgreSQL')]
|
||||||
public function testByJsonPathSucceedsForPostgreSQL(): void
|
public function testByJsonPathSucceedsForPostgreSQL(): void
|
||||||
{
|
{
|
||||||
Configuration::overrideMode(Mode::PgSQL);
|
Configuration::overrideMode(Mode::PgSQL);
|
||||||
|
@ -124,7 +126,7 @@ class RemoveFieldsTest extends TestCase
|
||||||
'UPDATE statement not correct');
|
'UPDATE statement not correct');
|
||||||
}
|
}
|
||||||
|
|
||||||
#[TestDox('By JSON Path fails for non PostgreSQL')]
|
#[TestDox('byJsonPath() fails for non PostgreSQL')]
|
||||||
public function testByJsonPathFailsForNonPostgreSQL(): void
|
public function testByJsonPathFailsForNonPostgreSQL(): void
|
||||||
{
|
{
|
||||||
$this->expectException(DocumentException::class);
|
$this->expectException(DocumentException::class);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user