Resolve PHPStan level 6 findings
This commit is contained in:
@@ -34,7 +34,7 @@ class CustomTest extends TestCase
|
||||
ThrowawayDb::destroy($this->dbName);
|
||||
}
|
||||
|
||||
public function testRunQuerySucceedsWithAValidQuery()
|
||||
public function testRunQuerySucceedsWithAValidQuery(): void
|
||||
{
|
||||
$stmt = &Custom::runQuery('SELECT data FROM ' . ThrowawayDb::TABLE . ' LIMIT 1', []);
|
||||
try {
|
||||
@@ -44,7 +44,7 @@ class CustomTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function testRunQueryFailsWithAnInvalidQuery()
|
||||
public function testRunQueryFailsWithAnInvalidQuery(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
$stmt = &Custom::runQuery('GRAB stuff FROM over_there UNTIL done', []);
|
||||
@@ -55,7 +55,7 @@ class CustomTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
public function testListSucceedsWhenDataIsFound()
|
||||
public function testListSucceedsWhenDataIsFound(): void
|
||||
{
|
||||
$list = Custom::list(Query::selectFromTable(ThrowawayDb::TABLE), [], new DocumentMapper(TestDocument::class));
|
||||
$this->assertNotNull($list, 'The document list should not be null');
|
||||
@@ -64,7 +64,7 @@ class CustomTest extends TestCase
|
||||
$this->assertEquals(5, $count, 'There should have been 5 documents in the list');
|
||||
}
|
||||
|
||||
public function testListSucceedsWhenNoDataIsFound()
|
||||
public function testListSucceedsWhenNoDataIsFound(): void
|
||||
{
|
||||
$list = Custom::list(
|
||||
Query::selectFromTable(ThrowawayDb::TABLE) . " WHERE (data->>'num_value')::numeric > :value",
|
||||
@@ -73,7 +73,7 @@ class CustomTest extends TestCase
|
||||
$this->assertFalse($list->hasItems(), 'There should have been no documents in the list');
|
||||
}
|
||||
|
||||
public function testArraySucceedsWhenDataIsFound()
|
||||
public function testArraySucceedsWhenDataIsFound(): void
|
||||
{
|
||||
$array = Custom::array(Query::selectFromTable(ThrowawayDb::TABLE) . " WHERE data->>'sub' IS NOT NULL", [],
|
||||
new DocumentMapper(TestDocument::class));
|
||||
@@ -81,7 +81,7 @@ class CustomTest extends TestCase
|
||||
$this->assertCount(2, $array, 'There should have been 2 documents in the array');
|
||||
}
|
||||
|
||||
public function testArraySucceedsWhenNoDataIsFound()
|
||||
public function testArraySucceedsWhenNoDataIsFound(): void
|
||||
{
|
||||
$array = Custom::array(Query::selectFromTable(ThrowawayDb::TABLE) . " WHERE data->>'value' = :value",
|
||||
[':value' => 'not there'], new DocumentMapper(TestDocument::class));
|
||||
@@ -104,14 +104,14 @@ class CustomTest extends TestCase
|
||||
$this->assertTrue($doc->isNone(), 'There should not have been a document returned');
|
||||
}
|
||||
|
||||
public function testNonQuerySucceedsWhenOperatingOnData()
|
||||
public function testNonQuerySucceedsWhenOperatingOnData(): void
|
||||
{
|
||||
Custom::nonQuery('DELETE FROM ' . ThrowawayDb::TABLE, []);
|
||||
$remaining = Count::all(ThrowawayDb::TABLE);
|
||||
$this->assertEquals(0, $remaining, 'There should be no documents remaining in the table');
|
||||
}
|
||||
|
||||
public function testNonQuerySucceedsWhenNoDataMatchesWhereClause()
|
||||
public function testNonQuerySucceedsWhenNoDataMatchesWhereClause(): void
|
||||
{
|
||||
Custom::nonQuery('DELETE FROM ' . ThrowawayDb::TABLE . " WHERE (data->>'num_value')::numeric > :value",
|
||||
[':value' => 100]);
|
||||
@@ -119,7 +119,7 @@ class CustomTest extends TestCase
|
||||
$this->assertEquals(5, $remaining, 'There should be 5 documents remaining in the table');
|
||||
}
|
||||
|
||||
public function testScalarSucceeds()
|
||||
public function testScalarSucceeds(): void
|
||||
{
|
||||
$value = Custom::scalar("SELECT 5 AS it", [], new CountMapper());
|
||||
$this->assertEquals(5, $value, 'The scalar value was not returned correctly');
|
||||
|
||||
Reference in New Issue
Block a user