@@ -46,8 +46,30 @@ public function compare_cold_observables()
4646 onCompleted (300 ),
4747 ]));
4848
49- $ this ->assertTrue ($ records1 ->equals ($ records2 ));
5049 $ this ->assertMessages ([$ records1 ], [$ records2 ]);
50+ $ this ->assertTrue ($ records1 ->equals ($ records2 ));
51+ }
52+
53+ /**
54+ * @test
55+ */
56+ public function compare_cold_observables_not_equal ()
57+ {
58+ $ records1 = onNext (100 , $ this ->createColdObservable ([
59+ onNext (150 , 1 ),
60+ onNext (200 , 42 ), // this is wrong
61+ onNext (250 , 3 ),
62+ onCompleted (300 ),
63+ ]));
64+ $ records2 = onNext (100 , $ this ->createColdObservable ([
65+ onNext (150 , 1 ),
66+ onNext (200 , 2 ),
67+ onNext (250 , 3 ),
68+ onCompleted (300 ),
69+ ]));
70+
71+ $ this ->assertMessagesNotEqual ([$ records1 ], [$ records2 ]);
72+ $ this ->assertFalse ($ records1 ->equals ($ records2 ));
5173 }
5274
5375 /**
@@ -73,8 +95,8 @@ public function automatic_mock_observer_doesnt_create_loggable_subscription()
7395 onCompleted (300 ),
7496 ]));
7597
76- $ this ->assertTrue ($ records ->equals ($ expected ));
7798 $ this ->assertMessages ([$ records ], [$ expected ]);
99+ $ this ->assertTrue ($ records ->equals ($ expected ));
78100
79101 $ this ->assertSubscriptions ([], $ inner ->getSubscriptions ());
80102 }
@@ -84,7 +106,7 @@ public function automatic_mock_observer_doesnt_create_loggable_subscription()
84106 */
85107 public function compare_with_range_cold_observable ()
86108 {
87- $ records1 = onNext (100 , Observable::range (1 , 3 ));
109+ $ records1 = onNext (100 , Observable::range (1 , 3 , $ this -> scheduler ));
88110 $ records2 = onNext (100 , $ this ->createColdObservable ([
89111 onNext (1 , 1 ),
90112 onNext (2 , 2 ),
@@ -105,7 +127,7 @@ public function compare_with_delayed_range_cold_observable()
105127 onNext (100 , 2 ),
106128 onNext (150 , 3 ),
107129 onCompleted (200 )
108- ])->delay (100 ));
130+ ])->delay (100 , $ this -> scheduler ));
109131
110132 $ records2 = onNext (100 , $ this ->createColdObservable ([
111133 onNext (150 , 1 ),
@@ -131,6 +153,8 @@ public function observables_at_different_time_with_same_records_arent_equal()
131153 onNext (100 , 2 ),
132154 ]));
133155
156+ $ this ->scheduler ->start ();
157+
134158 $ this ->assertFalse ($ records1 ->equals ($ records2 ));
135159 $ this ->assertEquals ('[OnNext(1)@50, OnNext(2)@100]@50 ' , $ records1 ->__toString ());
136160 }
@@ -149,6 +173,8 @@ public function observables_with_inner_records_at_different_time_arent_equal()
149173 onNext (100 , 2 ),
150174 ]));
151175
176+ $ this ->scheduler ->start ();
177+
152178 $ this ->assertFalse ($ records1 ->equals ($ records2 ));
153179 $ this ->assertEquals ('[OnNext(1)@50, OnNext(2)@150]@100 ' , $ records1 ->__toString ());
154180 }
@@ -168,7 +194,7 @@ public function observables_with_more_nested_inner_observables()
168194 onNext (10 , 5 ),
169195 onNext (20 , 6 ),
170196 ])),
171- ])->delay (100 )),
197+ ])->delay (100 , $ this -> scheduler )),
172198 ]));
173199 $ records2 = onNext (100 , $ this ->createColdObservable ([
174200 onNext (50 , 1 ),
@@ -183,8 +209,8 @@ public function observables_with_more_nested_inner_observables()
183209 ])),
184210 ]));
185211
186- $ this ->assertTrue ($ records1 ->equals ($ records2 ));
187212 $ this ->assertMessages ([$ records1 ], [$ records2 ]);
213+ $ this ->assertTrue ($ records1 ->equals ($ records2 ));
188214 }
189215
190216 /**
@@ -202,7 +228,7 @@ public function observables_with_difference_in_nested_inner_observables()
202228 onNext (10 , 5 ),
203229 onNext (20 , 6 ),
204230 ])),
205- ])->delay (100 )),
231+ ])->delay (100 , $ this -> scheduler )),
206232 ]));
207233 $ records2 = onNext (100 , $ this ->createColdObservable ([
208234 onNext (50 , 1 ),
@@ -217,6 +243,7 @@ public function observables_with_difference_in_nested_inner_observables()
217243 ])),
218244 ]));
219245
246+ $ this ->scheduler ->start ();
220247 $ this ->assertFalse ($ records1 ->equals ($ records2 ));
221248 }
222249
0 commit comments