assertSame($expected[$i++], $value); }); Loop::run(); } /** * @depends testMerge */ public function testMergeWithFailedStream() { $exception = new \Exception; Loop::run(function () use (&$reason, $exception) { $producer = new Producer(function (callable $emit) use ($exception) { yield $emit(1); // Emit once before failing. throw $exception; }); $stream = Stream\merge([$producer, Stream\fromIterable(\range(1, 5))]); $callback = function ($exception, $value) use (&$reason) { $reason = $exception; }; $stream->onResolve($callback); }); $this->assertSame($exception, $reason); } /** * @expectedException \TypeError */ public function testNonStream() { Stream\merge([1]); } }