當前位置: 首頁>>代碼示例>>PHP>>正文


PHP onCompleted函數代碼示例

本文整理匯總了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());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:10,代碼來源:RangeTest.php

示例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());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:10,代碼來源:TimerObservableTest.php

示例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());
 }
開發者ID:voryx,項目名稱:Rx.PHP,代碼行數:11,代碼來源:FromArrayTest.php

示例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());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:11,代碼來源:SwitchLatestTest.php

示例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());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:13,代碼來源:SumTest.php

示例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());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:11,代碼來源:StartWithTest.php

示例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());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:11,代碼來源:TimestampTest.php

示例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());
 }
開發者ID:bluetechy,項目名稱:Rx.PHP,代碼行數:8,代碼來源:ToArrayTest.php

示例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());
 }
開發者ID:voryx,項目名稱:Rx.PHP,代碼行數:12,代碼來源:MergeAllTest.php

示例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());
 }
開發者ID:bluetechy,項目名稱:Rx.PHP,代碼行數:12,代碼來源:ColdObservableTest.php

示例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());
 }
開發者ID:voryx,項目名稱:Rx.PHP,代碼行數:12,代碼來源:IteratorObservableTest.php

示例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());
 }
開發者ID:zhiephie,項目名稱:Rx.PHP,代碼行數:9,代碼來源:SkipLastTest.php

示例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());
 }
開發者ID:ihor,項目名稱:RxPHP,代碼行數:12,代碼來源:DelayTest.php

示例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());
 }
開發者ID:Gasperowicz,項目名稱:Rx.PHP,代碼行數:12,代碼來源:TakeTest.php

示例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());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:12,代碼來源:PluckTest.php


注:本文中的onCompleted函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。