diff --git a/tests/Exception/ExceptionTest.php b/tests/Exception/ExceptionTest.php index c58ff729e8..b61a9ea5c9 100644 --- a/tests/Exception/ExceptionTest.php +++ b/tests/Exception/ExceptionTest.php @@ -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 */