Rx\Functional\Operator\SelectTest::map_with_index_throws PHP Метод

map_with_index_throws() публичный Метод

    public function map_with_index_throws()
    {
        $error = new Exception();
        $xs = $this->createHotObservable([onNext(180, 5), onNext(210, 4), onNext(240, 3), onNext(290, 2), onNext(350, 1), onError(400, $error), onNext(410, -1), onCompleted(420), onError(430, new Exception())]);
        $invoked = 0;
        $results = $this->scheduler->startWithCreate(function () use($xs, &$invoked) {
            return $xs->mapWithIndex(function ($index, $x) use(&$invoked) {
                $invoked++;
                if ($invoked === 3) {
                    throw new Exception();
                }
                return $x + 1 + $index * 10;
            });
        });
        $this->assertMessages([onNext(210, 5), onNext(240, 14), onError(290, $error)], $results->getMessages());
        $this->assertSubscriptions([subscribe(200, 290)], $xs->getSubscriptions());
        $this->assertEquals(3, $invoked);
    }