本文整理汇总了PHP中onCompleted函数的典型用法代码示例。如果您正苦于以下问题:PHP onCompleted函数的具体用法?PHP onCompleted怎么用?PHP onCompleted使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了onCompleted函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: range_five
/**
* @test
*/
public function range_five()
{
$results = $this->scheduler->startWithCreate(function () {
return Observable::range(10, 5, $this->scheduler);
});
$this->assertMessages([onNext(201, 10), onNext(202, 11), onNext(203, 12), onNext(204, 13), onNext(205, 14), onCompleted(206)], $results->getMessages());
}
示例2: timer_one_shot_relative_time_negative
/**
* @test
*/
public function timer_one_shot_relative_time_negative()
{
$results = $this->scheduler->startWithCreate(function () {
return new TimerObservable(-1, $this->scheduler);
});
$this->assertMessages([onNext(201, 0), onCompleted(201)], $results->getMessages());
}
示例3: fromArray_one
/**
* @test
*/
public function fromArray_one()
{
$xs = Observable::fromArray([1]);
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs;
});
$this->assertMessages([onNext(201, 1), onCompleted(202)], $results->getMessages());
}
示例4: switchLatest_Dispose
/**
* @test
*/
public function switchLatest_Dispose()
{
$xs = $this->createHotObservable([onNext(300, $this->createColdObservable([onNext(10, 101), onNext(20, 102), onNext(110, 103), onNext(120, 104), onNext(210, 105), onNext(220, 106), onCompleted(230)])), onNext(400, $this->createColdObservable([onNext(10, 201), onNext(20, 202), onNext(30, 203), onNext(40, 204), onCompleted(50)])), onNext(500, $this->createColdObservable([onNext(10, 301), onNext(20, 302), onNext(30, 303), onNext(40, 304), onCompleted(150)])), onCompleted(600)]);
$results = $this->scheduler->startWithDispose(function () use($xs) {
return $xs->switchLatest();
}, 500);
$this->assertMessages([onNext(310, 101), onNext(320, 102), onNext(410, 201), onNext(420, 202), onNext(430, 203), onNext(440, 204)], $results->getMessages());
}
示例5: sum_number_some
/**
* Adapted from RxJS
*
* @test
*/
public function sum_number_some()
{
$xs = $this->createHotObservable([onNext(150, 1), onNext(210, 2), onNext(220, 3), onNext(230, 4), onCompleted(250)]);
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs->sum();
});
$this->assertMessages([onNext(250, 2 + 3 + 4), onCompleted(250)], $results->getMessages());
}
示例6: startWith_multiple_before
/**
* @test
*/
public function startWith_multiple_before()
{
$xs = $this->createHotObservable([onNext(150, 1), onNext(202, 4), onCompleted(250)]);
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs->startWithArray([1, 2, 3]);
});
$this->assertMessages([onNext(201, 1), onNext(202, 2), onNext(203, 3), onCompleted(250)], $results->getMessages());
}
示例7: timestamp_dispose
/**
* @test
*/
public function timestamp_dispose()
{
$xs = $this->createHotObservable([onNext(150, 1), onNext(210, 2), onNext(230, 3), onNext(260, 4), onNext(300, 5), onNext(350, 6), onCompleted(400)]);
$results = $this->scheduler->startWithDispose(function () use($xs) {
return $xs->timestamp($this->scheduler);
}, 275);
$this->assertMessages([onNext(210, new Timestamped(210, 2)), onNext(230, new Timestamped(230, 3)), onNext(260, new Timestamped(260, 4))], $results->getMessages());
}
示例8: testToArrayCompleted
public function testToArrayCompleted()
{
$xs = $this->createHotObservable([onNext(110, 1), onNext(220, 2), onNext(330, 3), onNext(440, 4), onNext(550, 5), onCompleted(660)]);
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs->toArray();
});
$this->assertMessages([onNext(660, [2, 3, 4, 5]), onCompleted(660)], $results->getMessages());
}
示例9: it_passes_on_completed_from_sources
/**
* @test
*/
public function it_passes_on_completed_from_sources()
{
$ys = $this->createHotObservable(array(onCompleted(250)));
$results = $this->scheduler->startWithCreate(function () use($ys) {
return Observable::mergeAll($ys);
});
$this->assertMessages(array(onCompleted(250)), $results->getMessages());
$this->assertSubscriptions(array(subscribe(200, 250)), $ys->getSubscriptions());
}
示例10: it_calls_relative_to_subscribe_time
/**
* @test
*/
public function it_calls_relative_to_subscribe_time()
{
$xs = $this->createColdObservable(array(onNext(50, "foo"), onNext(75, "Bar"), onCompleted(105)));
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs;
});
$this->assertCount(3, $results->getMessages());
$this->assertMessages(array(onNext(250, "foo"), onNext(275, "Bar"), onCompleted(305)), $results->getMessages());
}
示例11: generator_yields_one
/**
* @test
*/
public function generator_yields_one()
{
$generator = $this->genOne();
$xs = new \Rx\Observable\IteratorObservable($generator);
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs;
});
$this->assertMessages([onNext(201, 1), onCompleted(202)], $results->getMessages());
}
示例12: testSkipLastThreeCompleted
public function testSkipLastThreeCompleted()
{
$xs = $this->createHotObservable([onNext(180, 1), onNext(210, 2), onNext(250, 3), onNext(270, 4), onNext(310, 5), onNext(360, 6), onNext(380, 7), onNext(410, 8), onNext(590, 9), onCompleted(650)]);
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs->skipLast(3);
});
$this->assertMessages([onNext(310, 2), onNext(360, 3), onNext(380, 4), onNext(410, 5), onNext(590, 6), onCompleted(650)], $results->getMessages());
$this->assertSubscriptions([subscribe(200, 650)], $xs->getSubscriptions());
}
示例13: delay_empty
/**
* @test
*/
public function delay_empty()
{
$xs = $this->createHotObservable([onNext(150, 1), onCompleted(550)]);
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs->delay(10, $this->scheduler);
});
$this->assertMessages([onCompleted(560)], $results->getMessages());
$this->assertSubscriptions([subscribe(200, 550)], $xs->getSubscriptions());
}
示例14: take_zero_calls_on_completed
/**
* @test
*/
public function take_zero_calls_on_completed()
{
$scheduler = $this->createTestScheduler();
$xs = $this->createHotObservable(array(onNext(300, 21), onNext(500, 42), onNext(800, 84), onCompleted(820)));
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs->take(0);
});
$this->assertMessages(array(onCompleted(201)), $results->getMessages());
}
示例15: pluck_array_numeric_index
/**
* @test
*/
public function pluck_array_numeric_index()
{
$xs = $this->createHotObservable([onNext(180, [-1, -1, -1, -1]), onNext(210, [4, 3, 2, 1]), onNext(240, [4, 3, 20, 10]), onNext(290, [4, 3, 200, 100]), onNext(350, [4, 3, 2000, 1000]), onCompleted(400)]);
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs->pluck(2);
});
$this->assertMessages([onNext(210, 2), onNext(240, 20), onNext(290, 200), onNext(350, 2000), onCompleted(400)], $results->getMessages());
$this->assertSubscriptions([subscribe(200, 400)], $xs->getSubscriptions());
}