Initial SQLite development (#1)
Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
39
tests/unit/ConfigurationTest.php
Normal file
39
tests/unit/ConfigurationTest.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace Test\Unit;
|
||||
|
||||
use BitBadger\PDODocument\{Configuration, DocumentException};
|
||||
use PHPUnit\Framework\Attributes\TestDox;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* Unit tests for the Configuration class
|
||||
*/
|
||||
class ConfigurationTest extends TestCase
|
||||
{
|
||||
#[TestDox('ID field default succeeds')]
|
||||
public function testIdFieldDefaultSucceeds(): void
|
||||
{
|
||||
$this->assertEquals('id', Configuration::$idField, 'Default ID field should be "id"');
|
||||
}
|
||||
|
||||
#[TestDox('ID field change succeeds')]
|
||||
public function testIdFieldChangeSucceeds()
|
||||
{
|
||||
try {
|
||||
Configuration::$idField = 'EyeDee';
|
||||
$this->assertEquals('EyeDee', Configuration::$idField, 'ID field should have been updated');
|
||||
} finally {
|
||||
Configuration::$idField = 'id';
|
||||
$this->assertEquals('id', Configuration::$idField, 'Default ID value should have been restored');
|
||||
}
|
||||
}
|
||||
|
||||
#[TestDox("Db conn fails when no DSN specified")]
|
||||
public function testDbConnFailsWhenNoDSNSpecified(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
Configuration::$pdoDSN = '';
|
||||
Configuration::dbConn();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user