Code Duplication    Length = 12-12 lines in 4 locations

test/unit/Collection/ImmutableCollectionTest.php 4 locations

@@ 76-87 (lines=12) @@
73
        $this->assertEquals(3, count($coll));
74
    }
75
76
    public function testFilter()
77
    {
78
        $coll = new ImmutableCollection(['foo', 'bar', 'baz']);
79
        $result = $coll->filter(function ($item) {
80
            return 'foo' !== $item;
81
        });
82
83
        $this->assertEquals(['foo', 'bar', 'baz'], $coll->getAll());
84
        $this->assertEquals(['bar', 'baz'], $result->getAll());
85
        $this->assertNotSame($coll, $result);
86
        $this->assertInstanceOf('Graze\DataStructure\Collection\ImmutableCollection', $result);
87
    }
88
89
    public function testGetIterator()
90
    {
@@ 116-127 (lines=12) @@
113
        $this->assertEquals('foobarbaz', $result);
114
    }
115
116
    public function testSort()
117
    {
118
        $coll = new ImmutableCollection([2, 3, 1]);
119
        $result = $coll->sort(s\comparison_fn(function ($item) {
120
            return $item;
121
        }));
122
123
        $this->assertEquals([2, 3, 1], $coll->getAll());
124
        $this->assertEquals([1, 2, 3], $result->getAll());
125
        $this->assertNotSame($coll, $result);
126
        $this->assertInstanceOf('Graze\DataStructure\Collection\ImmutableCollection', $result);
127
    }
128
129
    public function testSortOnAsc()
130
    {
@@ 129-140 (lines=12) @@
126
        $this->assertInstanceOf('Graze\DataStructure\Collection\ImmutableCollection', $result);
127
    }
128
129
    public function testSortOnAsc()
130
    {
131
        $coll = new ImmutableCollection([2, 3, 1]);
132
        $result = $coll->sortOn(function ($item) {
133
            return $item;
134
        });
135
136
        $this->assertEquals([2, 3, 1], $coll->getAll());
137
        $this->assertEquals([1, 2, 3], $result->getAll());
138
        $this->assertNotSame($coll, $result);
139
        $this->assertInstanceOf('Graze\DataStructure\Collection\ImmutableCollection', $result);
140
    }
141
142
    public function testSortOnDesc()
143
    {
@@ 142-153 (lines=12) @@
139
        $this->assertInstanceOf('Graze\DataStructure\Collection\ImmutableCollection', $result);
140
    }
141
142
    public function testSortOnDesc()
143
    {
144
        $coll = new ImmutableCollection([2, 3, 1]);
145
        $result = $coll->sortOn(function ($item) {
146
            return $item;
147
        }, s\DESC);
148
149
        $this->assertEquals([2, 3, 1], $coll->getAll());
150
        $this->assertEquals([3, 2, 1], $result->getAll());
151
        $this->assertNotSame($coll, $result);
152
        $this->assertInstanceOf('Graze\DataStructure\Collection\ImmutableCollection', $result);
153
    }
154
155
    public function testSerialize()
156
    {