Skip to content

Commit 0a0a691

Browse files
committed
make sure automatic subscriptions aren't logged
1 parent d894afc commit 0a0a691

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/Rx/Testing/RecordedTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,35 @@ public function compare_cold_observables()
4848
$this->assertMessages([$records1], [$records2]);
4949
}
5050

51+
/**
52+
* @test
53+
*/
54+
public function automatic_mock_observer_doesnt_create_loggable_subscription()
55+
{
56+
$inner = $this->createColdObservable([
57+
onNext(150, 1),
58+
onNext(200, 2),
59+
onNext(250, 3),
60+
onCompleted(300),
61+
]);
62+
// Thanks to OnNextObservableNotification this internally creates
63+
// an instance of MockHigherOrderObserver which is not logged
64+
// by the ColdObservable::subscribe() method.
65+
$records = onNext(100, $inner);
66+
67+
$expected = onNext(100, $this->createColdObservable([
68+
onNext(150, 1),
69+
onNext(200, 2),
70+
onNext(250, 3),
71+
onCompleted(300),
72+
]));
73+
74+
$this->assertTrue($records->equals($expected));
75+
$this->assertMessages([$records], [$expected]);
76+
77+
$this->assertSubscriptions([], $inner->getSubscriptions());
78+
}
79+
5180
/**
5281
* @test
5382
*/

0 commit comments

Comments
 (0)