本文整理汇总了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());
}
示例2: testAsObservableNever
public function testAsObservableNever()
{
$results = $this->scheduler->startWithCreate(function () {
return Observable::never()->asObservable();
});
$this->assertMessages([], $results->getMessages());
}
示例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());
}
示例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());
}
示例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());
}
示例6: testScanNoSeedNever
public function testScanNoSeedNever()
{
$results = $this->scheduler->startWithCreate(function () {
return Observable::never()->scan(function ($acc, $x) {
return $acc + $x;
});
});
$this->assertMessages([], $results->getMessages());
}
示例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));
}
示例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());
}
示例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());
}
示例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');
}
示例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());
}
示例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());
}
示例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());
}
示例14:
<?php
require_once __DIR__ . '/../bootstrap.php';
$observable = \Rx\Observable::never();
$observable->subscribe($stdoutObserver);
示例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());
}