Rx\Functional\Operator\ConcatMapTest::concatMap_Then_Error_Task PHP Method

concatMap_Then_Error_Task() public method

    public function concatMap_Then_Error_Task()
    {
        $xs = Observable::fromArray([4, 3, 2, 1]);
        $results = [];
        $completed = false;
        $error = false;
        $xs->concatMap(function ($x, $i) {
            return Observable::error(new Exception($x + $i));
        })->subscribeCallback(function ($x) use(&$results) {
            $results[] = $x;
        }, function (\Exception $e) use(&$results, &$error) {
            $error = true;
            $this->assertEquals(4, $e->getMessage());
        }, function () use(&$completed) {
            $completed = true;
        });
        $this->assertFalse($completed);
        $this->assertTrue($error);
    }