assertSame($exception, $reason); return; } $this->fail('Failed promise reason should be thrown from loop'); } /** * @depends testRethrow */ public function testReactPromise() { $exception = new \Exception; try { Loop::run(function () use ($exception) { $promise = reject($exception); Amp\rethrow($promise); }); } catch (\Exception $reason) { $this->assertSame($exception, $reason); return; } $this->fail('Failed promise reason should be thrown from loop'); } public function testNonPromise() { $this->expectException(Amp\UnionTypeError::class); Amp\rethrow(42); } }