-
Notifications
You must be signed in to change notification settings - Fork 141
/
Copy pathMergeAllTest.php
64 lines (52 loc) · 1.57 KB
/
MergeAllTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
declare(strict_types = 1);
namespace Rx\Functional\Operator;
use Exception;
use Rx\Functional\FunctionalTestCase;
use Rx\Observable;
class MergeAllTest extends FunctionalTestCase
{
/**
* @test
*/
public function it_passes_on_error_from_sources()
{
$xs = $this->createColdObservable(array(
onNext(100, 4),
onNext(200, 2),
onNext(300, 3),
onNext(400, 1),
onCompleted(500)
));
$ys = $this->createColdObservable(array(
onNext(50, $xs),
onError(200, new Exception()),
onCompleted(250)
));
$results = $this->scheduler->startWithCreate(function() use ($ys) {
return $ys->mergeAll();
});
$this->assertMessages(array(
onNext(350, 4),
onError(400, new Exception()),
), $results->getMessages());
$this->assertSubscriptions(array(subscribe(250, 400)), $xs->getSubscriptions());
$this->assertSubscriptions(array(subscribe(200, 400)), $ys->getSubscriptions());
}
/**
* @test
*/
public function it_passes_on_completed_from_sources()
{
$ys = $this->createHotObservable(array(
onCompleted(250),
));
$results = $this->scheduler->startWithCreate(function() use ($ys) {
return $ys->mergeAll();
});
$this->assertMessages(array(
onCompleted(250),
), $results->getMessages());
$this->assertSubscriptions(array(subscribe(200, 250)), $ys->getSubscriptions());
}
}