@@ -47,7 +47,7 @@ public function testThatNestedExceptionClassAreFound()
47
47
$ exception = new MyOwnException ();
48
48
49
49
$ handlerException = new HandlerFailedException ($ envelope , [new \LogicException (), $ exception ]);
50
- $ this ->assertSame ([$ exception ], $ handlerException ->getNestedExceptionOfClass (MyOwnException::class));
50
+ $ this ->assertSame ([$ exception ], $ handlerException ->getWrappedExceptions (MyOwnException::class));
51
51
}
52
52
53
53
public function testThatNestedExceptionClassAreFoundWhenUsingChildException ()
@@ -56,7 +56,7 @@ public function testThatNestedExceptionClassAreFoundWhenUsingChildException()
56
56
$ exception = new MyOwnChildException ();
57
57
58
58
$ handlerException = new HandlerFailedException ($ envelope , [$ exception ]);
59
- $ this ->assertSame ([$ exception ], $ handlerException ->getNestedExceptionOfClass (MyOwnException::class));
59
+ $ this ->assertSame ([$ exception ], $ handlerException ->getWrappedExceptions (MyOwnException::class));
60
60
}
61
61
62
62
public function testThatNestedExceptionClassAreNotFoundIfNotPresent ()
@@ -65,7 +65,7 @@ public function testThatNestedExceptionClassAreNotFoundIfNotPresent()
65
65
$ exception = new \LogicException ();
66
66
67
67
$ handlerException = new HandlerFailedException ($ envelope , [$ exception ]);
68
- $ this ->assertCount (0 , $ handlerException ->getNestedExceptionOfClass (MyOwnException::class));
68
+ $ this ->assertCount (0 , $ handlerException ->getWrappedExceptions (MyOwnException::class));
69
69
}
70
70
71
71
public function testThatWrappedExceptionsRecursive ()
@@ -78,4 +78,26 @@ public function testThatWrappedExceptionsRecursive()
78
78
$ handlerException = new HandlerFailedException ($ envelope , [$ exception1 , $ exception2 , new DelayedMessageHandlingException ([$ exception3 ])]);
79
79
$ this ->assertSame ([$ exception1 , $ exception2 , $ exception3 ], $ handlerException ->getWrappedExceptions (recursive: true ));
80
80
}
81
+
82
+ public function testThatWrappedExceptionsRecursiveStringKeys ()
83
+ {
84
+ $ envelope = new Envelope (new \stdClass ());
85
+ $ exception1 = new \LogicException ();
86
+ $ exception2 = new MyOwnException ('second ' );
87
+ $ exception3 = new MyOwnException ('third ' );
88
+
89
+ $ handlerException = new HandlerFailedException ($ envelope , ['first ' => $ exception1 , 'second ' => $ exception2 , new DelayedMessageHandlingException (['third ' => $ exception3 ])]);
90
+ $ this ->assertSame (['first ' => $ exception1 , 'second ' => $ exception2 , 'third ' => $ exception3 ], $ handlerException ->getWrappedExceptions (recursive: true ));
91
+ }
92
+
93
+ public function testThatWrappedExceptionsByClassRecursive ()
94
+ {
95
+ $ envelope = new Envelope (new \stdClass ());
96
+ $ exception1 = new \LogicException ();
97
+ $ exception2 = new MyOwnException ('second ' );
98
+ $ exception3 = new MyOwnException ('third ' );
99
+
100
+ $ handlerException = new HandlerFailedException ($ envelope , [$ exception1 , $ exception2 , new DelayedMessageHandlingException ([$ exception3 ])]);
101
+ $ this ->assertSame ([$ exception2 , $ exception3 ], $ handlerException ->getWrappedExceptions (class: MyOwnException::class, recursive: true ));
102
+ }
81
103
}
0 commit comments