Update testdox for integration tests
This commit is contained in:
@@ -34,6 +34,7 @@ class CustomTest extends TestCase
|
||||
ThrowawayDb::destroy($this->dbName);
|
||||
}
|
||||
|
||||
#[TestDox('runQuery() succeeds with a valid query')]
|
||||
public function testRunQuerySucceedsWithAValidQuery(): void
|
||||
{
|
||||
$stmt = &Custom::runQuery('SELECT data FROM ' . ThrowawayDb::TABLE . ' LIMIT 1', []);
|
||||
@@ -44,6 +45,7 @@ class CustomTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('runQuery() fails with an invalid query')]
|
||||
public function testRunQueryFailsWithAnInvalidQuery(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
@@ -55,6 +57,7 @@ class CustomTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox('list() succeeds when data is found')]
|
||||
public function testListSucceedsWhenDataIsFound(): void
|
||||
{
|
||||
$list = Custom::list(Query::selectFromTable(ThrowawayDb::TABLE), [], new DocumentMapper(TestDocument::class));
|
||||
@@ -64,6 +67,7 @@ class CustomTest extends TestCase
|
||||
$this->assertEquals(5, $count, 'There should have been 5 documents in the list');
|
||||
}
|
||||
|
||||
#[TestDox('list() succeeds when no data is found')]
|
||||
public function testListSucceedsWhenNoDataIsFound(): void
|
||||
{
|
||||
$list = Custom::list(Query::selectFromTable(ThrowawayDb::TABLE) . " WHERE data->>'num_value' > :value",
|
||||
@@ -72,6 +76,7 @@ class CustomTest extends TestCase
|
||||
$this->assertFalse($list->hasItems(), 'There should have been no documents in the list');
|
||||
}
|
||||
|
||||
#[TestDox('array() succeeds when data is found')]
|
||||
public function testArraySucceedsWhenDataIsFound(): void
|
||||
{
|
||||
$array = Custom::array(Query::selectFromTable(ThrowawayDb::TABLE) . " WHERE data->>'sub' IS NOT NULL", [],
|
||||
@@ -80,6 +85,7 @@ class CustomTest extends TestCase
|
||||
$this->assertCount(2, $array, 'There should have been 2 documents in the array');
|
||||
}
|
||||
|
||||
#[TestDox('array() succeeds when no data is found')]
|
||||
public function testArraySucceedsWhenNoDataIsFound(): void
|
||||
{
|
||||
$array = Custom::array(Query::selectFromTable(ThrowawayDb::TABLE) . " WHERE data->>'value' = :value",
|
||||
@@ -88,6 +94,7 @@ class CustomTest extends TestCase
|
||||
$this->assertCount(0, $array, 'There should have been no documents in the array');
|
||||
}
|
||||
|
||||
#[TestDox('single() succeeds when a row is found')]
|
||||
public function testSingleSucceedsWhenARowIsFound(): void
|
||||
{
|
||||
$doc = Custom::single('SELECT data FROM ' . ThrowawayDb::TABLE . " WHERE data->>'id' = :id", [':id' => 'one'],
|
||||
@@ -96,6 +103,7 @@ class CustomTest extends TestCase
|
||||
$this->assertEquals('one', $doc->get()->id, 'The incorrect document was returned');
|
||||
}
|
||||
|
||||
#[TestDox('single() succeeds when a row is not found')]
|
||||
public function testSingleSucceedsWhenARowIsNotFound(): void
|
||||
{
|
||||
$doc = Custom::single('SELECT data FROM ' . ThrowawayDb::TABLE . " WHERE data->>'id' = :id",
|
||||
@@ -103,6 +111,7 @@ class CustomTest extends TestCase
|
||||
$this->assertTrue($doc->isNone(), 'There should not have been a document returned');
|
||||
}
|
||||
|
||||
#[TestDox('nonQuery() succeeds when operating on data')]
|
||||
public function testNonQuerySucceedsWhenOperatingOnData(): void
|
||||
{
|
||||
Custom::nonQuery('DELETE FROM ' . ThrowawayDb::TABLE, []);
|
||||
@@ -110,6 +119,7 @@ class CustomTest extends TestCase
|
||||
$this->assertEquals(0, $remaining, 'There should be no documents remaining in the table');
|
||||
}
|
||||
|
||||
#[TestDox('nonQuery() succeeds when no data matches WHERE clause')]
|
||||
public function testNonQuerySucceedsWhenNoDataMatchesWhereClause(): void
|
||||
{
|
||||
Custom::nonQuery('DELETE FROM ' . ThrowawayDb::TABLE . " WHERE data->>'num_value' > :value", [':value' => 100]);
|
||||
@@ -117,6 +127,7 @@ class CustomTest extends TestCase
|
||||
$this->assertEquals(5, $remaining, 'There should be 5 documents remaining in the table');
|
||||
}
|
||||
|
||||
#[TestDox('scalar() succeeds')]
|
||||
public function testScalarSucceeds(): void
|
||||
{
|
||||
$value = Custom::scalar("SELECT 5 AS it", [], new CountMapper());
|
||||
|
||||
Reference in New Issue
Block a user