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

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

    public function map_with_index_not_completed()
    {
        $xs = $this->createHotObservable([onNext(180, 5), onNext(210, 4), onNext(240, 3), onNext(290, 2), onNext(350, 1)]);
        $invoked = 0;
        $results = $this->scheduler->startWithCreate(function () use($xs, &$invoked) {
            return $xs->mapWithIndex(function ($index, $x) use(&$invoked) {
                $invoked++;
                return $x + 1 + $index * 10;
            });
        });
        $this->assertMessages([onNext(210, 5), onNext(240, 14), onNext(290, 23), onNext(350, 32)], $results->getMessages());
        $this->assertSubscriptions([subscribe(200, 1000)], $xs->getSubscriptions());
        $this->assertEquals(4, $invoked);
    }