From 4e76b9158f98f7f0c23c710b95ccc8eb06337f05 Mon Sep 17 00:00:00 2001 From: Ashley Allen Date: Mon, 19 Apr 2021 15:43:38 +0100 Subject: [PATCH] Added test for sole(). --- tests/Support/SupportLazyCollectionIsLazyTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/Support/SupportLazyCollectionIsLazyTest.php b/tests/Support/SupportLazyCollectionIsLazyTest.php index c523038c450c..82730fe587af 100644 --- a/tests/Support/SupportLazyCollectionIsLazyTest.php +++ b/tests/Support/SupportLazyCollectionIsLazyTest.php @@ -977,6 +977,17 @@ public function testSomeIsLazy() }); } + public function testSoleIsLazy() + { + $data = $this->make([['a' => 1], ['a' => 2], ['a' => 3]]); + + $this->assertEnumeratesCollection($data, 3, function ($collection) { + $collection->sole(function ($item) { + return $item['a'] === 2; + }); + }); + } + public function testSortIsLazy() { $this->assertDoesNotEnumerate(function ($collection) {