public function to_observable_cancels_on_dispose()
{
$canceled = false;
$deferred = new Deferred(function () use(&$canceled) {
$canceled = true;
});
$o = Promise::toObservable($deferred->promise());
$this->scheduler->schedule(function () use($deferred) {
$deferred->resolve(1);
}, 300);
$results = $this->scheduler->startWithDispose(function () use($o) {
// adding the merge causes 2 subscriptions to test that the count
// of cancels works correctly through disposal
return $o->merge($o);
}, 250);
$this->assertMessages([], $results->getMessages());
$this->assertTrue($canceled);
}