Skip to content

Commit 601eb3b

Browse files
committed
test: add negative limit test
1 parent bc8df43 commit 601eb3b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/Support/SupportLazyCollectionTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,23 @@ public function testUniqueDoubleEnumeration()
231231

232232
$this->assertSame([1, 2], $data->all());
233233
}
234+
235+
public function testTakeWithNegativeLimit()
236+
{
237+
$data = LazyCollection::times(10);
238+
239+
$this->assertSame([
240+
7 => 8,
241+
8 => 9,
242+
9 => 10,
243+
], $data->take(-3)->all());
244+
245+
$this->assertSame([
246+
7 => 8,
247+
8 => 9,
248+
9 => 10,
249+
], $data->take(-5)->take(-3)->all());
250+
251+
$this->assertSame($data->take(10)->all(), $data->take(-10)->all());
252+
}
234253
}

0 commit comments

Comments
 (0)