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


PHP Observable::never方法代碼示例

本文整理匯總了PHP中Rx\Observable::never方法的典型用法代碼示例。如果您正苦於以下問題:PHP Observable::never方法的具體用法?PHP Observable::never怎麽用?PHP Observable::never使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Rx\Observable的用法示例。


在下文中一共展示了Observable::never方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: never_basic

 /**
  * @test
  */
 public function never_basic()
 {
     $xs = Observable::never();
     $results = new MockObserver($this->scheduler);
     $xs->subscribe($results);
     $this->assertMessages([], $results->getMessages());
 }
開發者ID:voryx,項目名稱:Rx.PHP,代碼行數:10,代碼來源:NeverTest.php

示例2: testAsObservableNever

 public function testAsObservableNever()
 {
     $results = $this->scheduler->startWithCreate(function () {
         return Observable::never()->asObservable();
     });
     $this->assertMessages([], $results->getMessages());
 }
開發者ID:voryx,項目名稱:Rx.PHP,代碼行數:7,代碼來源:AsObservableTest.php

示例3: distinct_until_changed_never

 /**
  * @test
  */
 public function distinct_until_changed_never()
 {
     $results = $this->scheduler->startWithCreate(function () {
         $o = new EmptyObservable();
         return Observable::never()->distinctUntilChanged();
     });
     $this->assertMessages([], $results->getMessages());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:11,代碼來源:DistinctUntilChangedTest.php

示例4: testSkipUntilNeverNever

 public function testSkipUntilNeverNever()
 {
     $l = Observable::never();
     $r = Observable::never();
     $results = $this->scheduler->startWithCreate(function () use($l, $r) {
         return $l->skipUntil($r);
     });
     $this->assertMessages([], $results->getMessages());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:9,代碼來源:SkipUntilTest.php

示例5: race_empty_never

 /**
  * @test
  */
 public function race_empty_never()
 {
     $n1 = Observable::never();
     $e = $this->createHotObservable([onNext(150, 1), onCompleted(225)]);
     $results = $this->scheduler->startWithCreate(function () use($n1, $e) {
         return Observable::race([$e, $n1]);
     });
     $this->assertMessages([onCompleted(225)], $results->getMessages());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:12,代碼來源:RaceTest.php

示例6: testScanNoSeedNever

 public function testScanNoSeedNever()
 {
     $results = $this->scheduler->startWithCreate(function () {
         return Observable::never()->scan(function ($acc, $x) {
             return $acc + $x;
         });
     });
     $this->assertMessages([], $results->getMessages());
 }
開發者ID:voryx,項目名稱:Rx.PHP,代碼行數:9,代碼來源:ScanTest.php

示例7: await_default_timeout

 /**
  * @test
  */
 public function await_default_timeout()
 {
     $start = microtime(true);
     $observable = Observable::never()->takeUntil(Observable::timer(2000));
     $generator = \Rx\await($observable);
     foreach ($generator as $item) {
     }
     $totalTime = microtime(true) - $start;
     $this->assertEquals('2', round($totalTime));
 }
開發者ID:RxPHP,項目名稱:RxAwait,代碼行數:13,代碼來源:FunctionAwaitTest.php

示例8: use

 /**
  * @test
  */
 function cut_never()
 {
     $xs = Observable::never();
     $results = $this->scheduler->startWithCreate(function () use($xs) {
         return $xs->lift(function () {
             return new CutOperator();
         });
     });
     $this->assertMessages([], $results->getMessages());
 }
開發者ID:RxPHP,項目名稱:RxOperatorExtras,代碼行數:13,代碼來源:CutTest.php

示例9: takeUntil_preempt_never_never

 /**
  * @test
  */
 public function takeUntil_preempt_never_never()
 {
     $l = Observable::never();
     $r = Observable::never();
     $result = $this->scheduler->startWithCreate(function () use($l, $r) {
         return $l->takeUntil($r);
     });
     $this->assertMessages([], $result->getMessages());
 }
開發者ID:voryx,項目名稱:Rx.PHP,代碼行數:12,代碼來源:TakeUntilTest.php

示例10: catchError_does_not_lose_subscription

 /**
  * does not lose subscription to underlying observable
  * @test
  */
 public function catchError_does_not_lose_subscription()
 {
     $subscribes = 0;
     $unsubscribes = 0;
     $tracer = Observable::create(function () use(&$subscribes, &$unsubscribes) {
         ++$subscribes;
         return new CallbackDisposable(function () use(&$unsubscribes) {
             ++$unsubscribes;
         });
     });
     // Try it without catchError()
     $s = $tracer->subscribe(new CallbackObserver());
     $this->assertEquals($subscribes, 1, '1 subscribes');
     $this->assertEquals($unsubscribes, 0, '0 unsubscribes');
     $s->dispose();
     $this->assertEquals($subscribes, 1, 'After dispose: 1 subscribes');
     $this->assertEquals($unsubscribes, 1, 'After dispose: 1 unsubscribes');
     // And now try again with catchError(function()):
     $subscribes = 0;
     $unsubscribes = 0;
     $s = $tracer->catchError(function () {
         return Observable::never();
     })->subscribe(new CallbackObserver());
     $this->assertEquals($subscribes, 1, 'catchError(Observable): 1 subscribes');
     $this->assertEquals($unsubscribes, 0, 'catchError(Observable): 0 unsubscribes');
     $s->dispose();
     $this->assertEquals($subscribes, 1, 'catchError(Observable): After dispose: 1 subscribes');
     $this->assertEquals($unsubscribes, 1, 'catchError(Observable): After dispose: 1 unsubscribes');
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:33,代碼來源:CatchErrorTest.php

示例11: materialize_dematerialize_never

 /**
  * @test
  * @requires function Rx\Observable::dematerialize
  */
 public function materialize_dematerialize_never()
 {
     $results = $this->scheduler->startWithCreate(function () {
         return Observable::never()->materialize()->dematerialize();
     });
     $this->assertMessages([], $results->getMessages());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:11,代碼來源:MaterializeTest.php

示例12: testConcatNeverReturn

 public function testConcatNeverReturn()
 {
     $e1 = $this->createHotObservable([onNext(150, 1), onNext(210, 2), onCompleted(230)]);
     $e2 = Observable::never();
     $results = $this->scheduler->startWithCreate(function () use($e1, $e2) {
         return $e2->concat($e1);
     });
     $this->assertMessages([], $results->getMessages());
 }
開發者ID:voryx,項目名稱:Rx.PHP,代碼行數:9,代碼來源:ConcatTest.php

示例13: testRetryWhenDisposeBetweenSourceSubscriptions

 public function testRetryWhenDisposeBetweenSourceSubscriptions()
 {
     $xs = $this->createColdObservable([onNext(10, 1), onNext(20, 2), onNext(30, 3), onNext(40, 4), onCompleted(50)]);
     $results = $this->scheduler->startWithDispose(function () use($xs) {
         return $xs->map(function ($x) {
             if ($x > 2) {
                 throw new \Exception();
             }
             return $x;
         })->retryWhen(function ($attempts) {
             return Observable::never();
         });
     }, 285);
     $this->assertMessages([onNext(210, 1), onNext(220, 2)], $results->getMessages());
     $this->assertSubscriptions([subscribe(200, 230)], $xs->getSubscriptions());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:16,代碼來源:RetryWhenTest.php

示例14:

<?php

require_once __DIR__ . '/../bootstrap.php';
$observable = \Rx\Observable::never();
$observable->subscribe($stdoutObserver);
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:5,代碼來源:never.php

示例15: repeatWhen_Observable_dispose_between

 /**
  * @test
  */
 public function repeatWhen_Observable_dispose_between()
 {
     $xs = $this->createColdObservable([onNext(10, 1), onNext(20, 2), onNext(30, 3), onNext(40, 4), onNext(50, 5), onCompleted(60)]);
     $results = $this->scheduler->startWithDispose(function () use($xs) {
         return $xs->repeatWhen(function () {
             return Observable::never();
         });
     }, 275);
     $this->assertMessages([onNext(210, 1), onNext(220, 2), onNext(230, 3), onNext(240, 4), onNext(250, 5)], $results->getMessages());
     $this->assertSubscriptions([subscribe(200, 260)], $xs->getSubscriptions());
 }
開發者ID:ReactiveX,項目名稱:RxPHP,代碼行數:14,代碼來源:RepeatWhenTest.php


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