Skip to content

Commit

Permalink
[11.x] Add test testMultiplyIsLazy to ensure LazyCollection's `mult…
Browse files Browse the repository at this point in the history
…iply` method's lazy behaviour (#52020)

* feat: add is lazy test for multiply collection method

* fix: make style-ci happy
  • Loading branch information
lmottasin committed Jul 5, 2024
1 parent 466987f commit afd85aa
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/Support/SupportLazyCollectionIsLazyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,20 @@ public function testConcatIsLazy()
$this->assertEnumerations(1, $secondEnumerations);
}

public function testMultiplyIsLazy()
{
$this->assertDoesNotEnumerate(function ($collection) {
$collection->multiply(2);
});

$this->assertEnumeratesCollectionOnce(
$this->make([1, 2, 3]),
function ($collection) {
return $collection->multiply(3)->all();
}
);
}

public function testContainsIsLazy()
{
$this->assertEnumerates(5, function ($collection) {
Expand Down

0 comments on commit afd85aa

Please sign in to comment.