Rx\Functional\Operator\DeferTest::defer_throw PHP Метод

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

public defer_throw ( )
    public function defer_throw()
    {
        $invoked = 0;
        $results = $this->scheduler->startWithCreate(function () use(&$invoked) {
            return Observable::defer(function () use(&$invoked) {
                $invoked++;
                throw new \Exception('error');
            });
        });
        // Note: these tests differ from the RxJS tests that they were based on because RxJS was
        // explicitly using the immediate scheduler on subscribe internally. When we pass the
        // proper scheduler in, the subscription gets scheduled which requires an extra tick.
        $this->assertMessages([onError(201, new \Exception('error'))], $results->getMessages());
        $this->assertEquals(1, $invoked);
    }