@@ -62,6 +62,8 @@ public function shouldResolveWithoutCreatingGarbageCyclesIfResolverResolvesWithE
6262 /** @test */
6363 public function shouldRejectWithoutCreatingGarbageCyclesIfResolverThrowsExceptionWithoutResolver ()
6464 {
65+ $ this ->expectException (Exception::class);
66+
6567 gc_collect_cycles ();
6668 $ promise = new Promise (function () {
6769 throw new \Exception ('foo ' );
@@ -74,6 +76,8 @@ public function shouldRejectWithoutCreatingGarbageCyclesIfResolverThrowsExceptio
7476 /** @test */
7577 public function shouldRejectWithoutCreatingGarbageCyclesIfResolverRejectsWithException ()
7678 {
79+ $ this ->expectException (Exception::class);
80+
7781 gc_collect_cycles ();
7882 $ promise = new Promise (function ($ resolve , $ reject ) {
7983 $ reject (new \Exception ('foo ' ));
@@ -86,6 +90,8 @@ public function shouldRejectWithoutCreatingGarbageCyclesIfResolverRejectsWithExc
8690 /** @test */
8791 public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerRejectsWithException ()
8892 {
93+ $ this ->expectException (Exception::class);
94+
8995 gc_collect_cycles ();
9096 $ promise = new Promise (function ($ resolve , $ reject ) { }, function ($ resolve , $ reject ) {
9197 $ reject (new \Exception ('foo ' ));
@@ -99,6 +105,8 @@ public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerRejectsWithEx
99105 /** @test */
100106 public function shouldRejectWithoutCreatingGarbageCyclesIfParentCancellerRejectsWithException ()
101107 {
108+ $ this ->expectException (Exception::class);
109+
102110 gc_collect_cycles ();
103111 $ promise = new Promise (function ($ resolve , $ reject ) { }, function ($ resolve , $ reject ) {
104112 $ reject (new \Exception ('foo ' ));
@@ -112,6 +120,8 @@ public function shouldRejectWithoutCreatingGarbageCyclesIfParentCancellerRejects
112120 /** @test */
113121 public function shouldRejectWithoutCreatingGarbageCyclesIfResolverThrowsException ()
114122 {
123+ $ this ->expectException (Exception::class);
124+
115125 gc_collect_cycles ();
116126 $ promise = new Promise (function ($ resolve , $ reject ) {
117127 throw new \Exception ('foo ' );
@@ -136,6 +146,8 @@ public function shouldRejectWithoutCreatingGarbageCyclesIfResolverThrowsExceptio
136146 */
137147 public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerWithReferenceThrowsException ()
138148 {
149+ $ this ->expectException (Exception::class);
150+
139151 gc_collect_cycles ();
140152 $ promise = new Promise (function () {}, function () use (&$ promise ) {
141153 throw new \Exception ('foo ' );
@@ -153,10 +165,14 @@ public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerWithReference
153165 */
154166 public function shouldRejectWithoutCreatingGarbageCyclesIfResolverWithReferenceThrowsException ()
155167 {
168+ $ this ->expectException (Exception::class);
169+
156170 gc_collect_cycles ();
157- $ promise = new Promise (function () use (&$ promise ) {
158- throw new \Exception ('foo ' );
159- });
171+ try {
172+ $ promise = new Promise (function () use (&$ promise ) {
173+ throw new \Exception ('foo ' );
174+ });
175+ } catch (\Throwable $ throwable ) {}
160176 unset($ promise );
161177
162178 $ this ->assertSame (0 , gc_collect_cycles ());
@@ -169,10 +185,15 @@ public function shouldRejectWithoutCreatingGarbageCyclesIfResolverWithReferenceT
169185 */
170186 public function shouldRejectWithoutCreatingGarbageCyclesIfCancellerHoldsReferenceAndResolverThrowsException ()
171187 {
188+ $ this ->expectException (Exception::class);
189+
172190 gc_collect_cycles ();
173- $ promise = new Promise (function () {
174- throw new \Exception ('foo ' );
175- }, function () use (&$ promise ) { });
191+ try {
192+ $ promise = new Promise (function () {
193+ throw new \Exception ('foo ' );
194+ }, function () use (&$ promise ) {
195+ });
196+ } catch (\Throwable $ throwable ) {}
176197 unset($ promise );
177198
178199 $ this ->assertSame (0 , gc_collect_cycles ());
@@ -263,10 +284,14 @@ public function shouldNotLeaveGarbageCyclesWhenRemovingLastReferenceToPendingPro
263284 /** @test */
264285 public function shouldFulfillIfFullfilledWithSimplePromise ()
265286 {
287+ $ this ->expectException (Exception::class);
288+
266289 gc_collect_cycles ();
267- $ promise = new Promise (function () {
268- throw new Exception ('foo ' );
269- });
290+ try {
291+ $ promise = new Promise (function () {
292+ throw new Exception ('foo ' );
293+ });
294+ } catch (\Throwable $ throwable ) {}
270295 unset($ promise );
271296
272297 self ::assertSame (0 , gc_collect_cycles ());
0 commit comments