public function distinct_CustomKey_all_distinct()
{
$xs = $this->createHotObservable([onNext(280, ['id' => 4]), onNext(300, ['id' => 2]), onNext(350, ['id' => 1]), onNext(380, ['id' => 3]), onNext(400, ['id' => 5]), onCompleted(420)]);
$results = $this->scheduler->startWithCreate(function () use($xs) {
return $xs->distinctKey(function ($x) {
return $x['id'];
})->map(function ($x) {
return $x['id'];
});
});
$this->assertMessages([onNext(280, 4), onNext(300, 2), onNext(350, 1), onNext(380, 3), onNext(400, 5), onCompleted(420)], $results->getMessages());
$this->assertSubscriptions([subscribe(200, 420)], $xs->getSubscriptions());
}