Pinq\Tests\Integration\Collection\GroupJoinApplyTest::testGroupJoinApplyToSelfWithInnerIndexBy PHP Method

testGroupJoinApplyToSelfWithInnerIndexBy() public method

public testGroupJoinApplyToSelfWithInnerIndexBy ( Pinq\ICollection $collection )
$collection Pinq\ICollection
    public function testGroupJoinApplyToSelfWithInnerIndexBy(\Pinq\ICollection $collection)
    {
        $inner = $collection->indexBy(function ($i) {
            return $i - 1;
        })->select(function ($i) {
            return (int) $i;
        });
        $collection->groupJoin($inner)->on(function ($outer, $inner) {
            return $outer > $inner;
        })->apply(function (&$outer, \Pinq\ITraversable $group) {
            $outer .= ':' . $group->implode(',');
        });
        $this->assertMatches($collection, [0 => '1:', 1 => '2:1', 2 => '3:1,2', 3 => '4:1,2,3', 4 => '5:1,2,3,4', 5 => '6:1,2,3,4,5', 6 => '7:1,2,3,4,5,6', 7 => '8:1,2,3,4,5,6,7', 8 => '9:1,2,3,4,5,6,7,8', 9 => '10:1,2,3,4,5,6,7,8,9']);
    }