public function testThatQueryUpdatesWhenSourceCollectionIsMutated(\Pinq\ICollection $collection, array $data)
{
$query = $collection->where(function ($i) {
return $i % 2 === 0;
})->orderByDescending(function ($i) {
return $i;
})->groupJoin(range(1, 10, 2))->on(function ($i, $v) {
return $v < $i;
})->to(function ($i, \Pinq\ITraversable $nums) {
return $i . ':' . $nums->implode(',');
});
$this->assertMatchesValues($query, ['10:1,3,5,7,9', '8:1,3,5,7', '6:1,3,5', '4:1,3', '2:1']);
$collection->removeRange([4, 5]);
unset($collection[7]);
$this->assertMatchesValues($query, ['10:1,3,5,7,9', '6:1,3,5', '2:1']);
}