Update testdox for remaining unit tests

This commit is contained in:
2024-09-22 20:18:17 -04:00
parent 294b608ac8
commit 91bf3128c5
12 changed files with 69 additions and 48 deletions

View File

@@ -25,12 +25,14 @@ 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);
@@ -39,7 +41,7 @@ class CountTest extends TestCase
'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);

View File

@@ -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);

View File

@@ -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,6 +32,7 @@ class DeleteTest extends TestCase
'DELETE statement not constructed correctly');
}
#[TestDox('byFields() succeeds')]
public function testByFieldsSucceeds(): void
{
Configuration::overrideMode(Mode::SQLite);
@@ -41,7 +42,7 @@ class DeleteTest extends TestCase
'DELETE statement not constructed 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 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);
@@ -64,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);

View File

@@ -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,6 +40,7 @@ class ExistsTest extends TestCase
'Existence query not generated correctly');
}
#[TestDox('byFields() succeeds')]
public function testByFieldsSucceeds(): void
{
Configuration::overrideMode(Mode::SQLite);
@@ -47,7 +49,7 @@ class ExistsTest extends TestCase
'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);

View File

@@ -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,6 +32,7 @@ class FindTest extends TestCase
'SELECT query not generated correctly');
}
#[TestDox('byFields() succeeds')]
public function testByFieldsSucceeds(): void
{
Configuration::overrideMode(Mode::SQLite);
@@ -41,7 +42,7 @@ class FindTest extends TestCase
'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);

View File

@@ -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,14 +40,14 @@ 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);
@@ -55,7 +55,7 @@ class PatchTest extends TestCase
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);
@@ -65,13 +65,14 @@ class PatchTest extends TestCase
'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);
@@ -79,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);
@@ -94,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);

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,13 +41,14 @@ 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')]
#[TestDox('byId() succeeds for PostgreSQL')]
public function testByIdSucceedsForPostgreSQL(): void
{
Configuration::overrideMode(Mode::PgSQL);
@@ -55,7 +56,7 @@ class RemoveFieldsTest extends TestCase
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
{
Configuration::overrideMode(Mode::SQLite);
@@ -64,14 +65,14 @@ 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')]
#[TestDox('byFields() succeeds for PostgreSQL')]
public function testByFieldsSucceedsForPostgreSQL(): void
{
Configuration::overrideMode(Mode::PgSQL);
@@ -81,7 +82,7 @@ class RemoveFieldsTest extends TestCase
'UPDATE statement not correct');
}
#[TestDox('By fields succeeds for SQLite')]
#[TestDox('byFields() succeeds for SQLite')]
public function testByFieldsSucceedsForSQLite(): void
{
Configuration::overrideMode(Mode::SQLite);
@@ -92,13 +93,14 @@ class RemoveFieldsTest extends TestCase
'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);