/** * @dataProvider oneToTen */ public function testThatApplyUpdatesScopedValuesWithScopeRefreshing(\Pinq\ICollection $collection, array $data) { $filteredScopeCollection = $collection->whereIn([1, 4, 7, 9, 10]); //1, 4, 7, 9, 10 $moreFilteredScopeCollection = $filteredScopeCollection->difference([4, 9]); //1, 7, 10 //After apply: 1 -> 10, 7 -> 70, 10 -> 100, only 10 is still in the current scope. $moreFilteredScopeCollection->apply(function (&$i) { $i *= 10; }); $this->assertMatchesValues($moreFilteredScopeCollection, [10]); $this->assertMatchesValues($filteredScopeCollection, [10, 4, 9]); $this->assertMatchesValues($collection, [10, 2, 3, 4, 5, 6, 70, 8, 9, 100]); }