Rx\Functional\Operator\DistinctTest::distinct_CustomComparer_some_throw PHP Метод

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

    public function distinct_CustomComparer_some_throw()
    {
        $error = new \Exception();
        $xs = $this->createHotObservable([onNext(280, 4), onNext(300, 2), onNext(350, 12), onNext(380, 3), onNext(400, 24), onCompleted(420)]);
        $results = $this->scheduler->startWithCreate(function () use($xs, $error) {
            return $xs->distinct(function ($x) use($error) {
                if ($x === 12) {
                    throw $error;
                }
            });
        });
        $this->assertMessages([onNext(280, 4), onNext(300, 2), onError(350, $error)], $results->getMessages());
        $this->assertSubscriptions([subscribe(200, 350)], $xs->getSubscriptions());
    }