当前位置: 首页>>代码示例>>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;未经允许,请勿转载。