Derive mode from DSN function

- Add headers in all files
- Minor field name changes
This commit is contained in:
2024-07-20 21:47:21 -04:00
parent 1a37b009ea
commit d8330d828a
81 changed files with 1053 additions and 551 deletions

View File

@@ -1,4 +1,10 @@
<?php
/**
* @author Daniel J. Summers <daniel@bitbadger.solutions>
* @license MIT
*/
declare(strict_types=1);
namespace Test\Unit;
@@ -13,7 +19,7 @@ use PHPUnit\Framework\TestCase;
#[TestDox('Document Exception (Unit tests)')]
class DocumentExceptionTest extends TestCase
{
public function testConstructorSucceedsWithCodeAndPriorException()
public function testConstructorSucceedsWithCodeAndPriorException(): void
{
$priorEx = new Exception('Uh oh');
$ex = new DocumentException('Test Exception', 17, $priorEx);
@@ -23,7 +29,7 @@ class DocumentExceptionTest extends TestCase
$this->assertSame($priorEx, $ex->getPrevious(), 'Prior exception not filled properly');
}
public function testConstructorSucceedsWithoutCodeAndPriorException()
public function testConstructorSucceedsWithoutCodeAndPriorException(): void
{
$ex = new DocumentException('Oops');
$this->assertNotNull($ex, 'The exception should not have been null');
@@ -32,14 +38,14 @@ class DocumentExceptionTest extends TestCase
$this->assertNull($ex->getPrevious(), 'Prior exception should have been null');
}
public function testToStringSucceedsWithoutCode()
public function testToStringSucceedsWithoutCode(): void
{
$ex = new DocumentException('Test failure');
$this->assertEquals("BitBadger\PDODocument\DocumentException: Test failure\n", "$ex",
'toString not generated correctly');
}
public function testToStringSucceedsWithCode()
public function testToStringSucceedsWithCode(): void
{
$ex = new DocumentException('Oof', -6);
$this->assertEquals("BitBadger\PDODocument\DocumentException: [-6] Oof\n", "$ex",