File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -134,6 +134,33 @@ public function resolveShouldRejectWhenResolvedWithItself()
134134 $ adapter ->resolve ($ adapter ->promise ());
135135 }
136136
137+ /**
138+ * @test
139+ */
140+ public function resolveShouldRejectWhenResolvedWithAPromiseWhichFollowsItself ()
141+ {
142+ $ adapter1 = $ this ->getPromiseTestAdapter ();
143+ $ adapter2 = $ this ->getPromiseTestAdapter ();
144+
145+ $ mock = $ this ->createCallableMock ();
146+ $ mock
147+ ->expects ($ this ->once ())
148+ ->method ('__invoke ' )
149+ ->with (new \LogicException ('Cannot resolve a promise with itself. ' ));
150+
151+ $ promise1 = $ adapter1 ->promise ();
152+
153+ $ promise2 = $ adapter2 ->promise ();
154+
155+ $ promise2 ->then (
156+ $ this ->expectCallableNever (),
157+ $ mock
158+ );
159+
160+ $ adapter1 ->resolve ($ promise2 );
161+ $ adapter2 ->resolve ($ promise1 );
162+ }
163+
137164 /** @test */
138165 public function doneShouldInvokeFulfillmentHandler ()
139166 {
You can’t perform that action at this time.
0 commit comments