$exception], [0 => 1, 2 => 3]], await(Promise\any($promises))); } public function testPendingPromiseArray() { $promises = [ asyncValue(20, 1), asyncValue(30, 2), asyncValue(10, 3), ]; self::assertEquals([[], [1, 2, 3]], await(Promise\any($promises))); } /** * @depends testMixedPromisesArray */ public function testArrayKeysPreserved() { $exception = new \Exception; $expected = [['two' => $exception], ['one' => 1, 'three' => 3]]; $promises = [ 'one' => asyncValue(20, 1), 'two' => new Failure($exception), 'three' => asyncValue(10, 3), ]; self::assertEquals($expected, await(Promise\any($promises))); } public function testNonPromise() { $this->expectException(\TypeError::class); Promise\any([1]); } }