Skip to content

Commit

Permalink
Test the new getDetails behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianallgeier committed Dec 13, 2024
1 parent 0a21d42 commit 7eeb398
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/Exception/ExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,44 @@ public function testDefaults()
$this->assertSame([], $exception->getDetails());
}

/**
* @covers ::getDetails
*/
public function testGetDetails()
{
$exception = new Exception(
details: $details = [
[
'label' => 'A',
'message' => 'Message A',
]
]
);

$this->assertSame($details, $exception->getDetails());
}

/**
* @covers ::getDetails
*/
public function testGetDetailsWithExceptions()
{
$exception = new Exception(
details: [
'A' => new Exception(message: 'Message A')
]
);

$expected = [
'A' => [
'label' => 'A',
'message' => 'Message A',
]
];

$this->assertSame($expected, $exception->getDetails());
}

/**
* @covers ::__construct
*/
Expand Down

0 comments on commit 7eeb398

Please sign in to comment.