From 775ecd21b057d830c0cbcd7b8c03afb7149c8d98 Mon Sep 17 00:00:00 2001 From: Jamison Valenta Date: Fri, 14 Apr 2023 15:50:23 -0600 Subject: [PATCH] v9.52.5 changes --- src/Collect/Support/Str.php | 2 +- tests/Support/SupportArrTest.php | 11 +++++++++++ tests/Support/SupportCollectionTest.php | 2 ++ tests/files/Support/Str.php | 2 +- upgrade.sh | 2 +- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Collect/Support/Str.php b/src/Collect/Support/Str.php index ea10983..07e8254 100644 --- a/src/Collect/Support/Str.php +++ b/src/Collect/Support/Str.php @@ -735,7 +735,7 @@ public static function random($length = 16) while (($len = strlen($string)) < $length) { $size = $length - $len; - $bytesSize = (int) ceil(($size) / 3) * 3; + $bytesSize = (int) ceil($size / 3) * 3; $bytes = random_bytes($bytesSize); diff --git a/tests/Support/SupportArrTest.php b/tests/Support/SupportArrTest.php index 127af2d..3dc4a9c 100644 --- a/tests/Support/SupportArrTest.php +++ b/tests/Support/SupportArrTest.php @@ -731,6 +731,12 @@ public function testRandom() $this->assertCount(2, array_intersect_assoc(['one' => 'foo', 'two' => 'bar', 'three' => 'baz'], $random)); } + public function testRandomNotIncrementingKeys() + { + $random = Arr::random(['foo' => 'foo', 'bar' => 'bar', 'baz' => 'baz']); + $this->assertContains($random, ['foo', 'bar', 'baz']); + } + public function testRandomOnEmptyArray() { $random = Arr::random([], 0); @@ -817,6 +823,11 @@ public function testShuffleWithSeed() ); } + public function testEmptyShuffle() + { + $this->assertEquals([], Arr::shuffle([])); + } + public function testSort() { $unsorted = [ diff --git a/tests/Support/SupportCollectionTest.php b/tests/Support/SupportCollectionTest.php index 6b7be12..f297681 100644 --- a/tests/Support/SupportCollectionTest.php +++ b/tests/Support/SupportCollectionTest.php @@ -4682,6 +4682,7 @@ public function testCollectionFromTraversableWithKeys($collection) /** * @dataProvider collectionClassProvider + * * @requires PHP >= 8.1 */ public function testCollectionFromEnum($collection) @@ -4692,6 +4693,7 @@ public function testCollectionFromEnum($collection) /** * @dataProvider collectionClassProvider + * * @requires PHP >= 8.1 */ public function testCollectionFromBackedEnum($collection) diff --git a/tests/files/Support/Str.php b/tests/files/Support/Str.php index b67f903..8145d3d 100644 --- a/tests/files/Support/Str.php +++ b/tests/files/Support/Str.php @@ -735,7 +735,7 @@ public static function random($length = 16) while (($len = strlen($string)) < $length) { $size = $length - $len; - $bytesSize = (int) ceil(($size) / 3) * 3; + $bytesSize = (int) ceil($size / 3) * 3; $bytes = random_bytes($bytesSize); diff --git a/upgrade.sh b/upgrade.sh index f74bf4d..cf7783b 100755 --- a/upgrade.sh +++ b/upgrade.sh @@ -382,7 +382,7 @@ function getCurrentVersionFromGitHub() echo Getting current version from $repository... if [ -z "$requestedVersion" ]; then - collectionVersion=$(git ls-remote $repository --tags v9.52\* | grep tags/ | grep -v {} | cut -d \/ -f 3 | cut -d v -f 2 | grep -v RC | grep -vi beta | sort -t. -k 1,1n -k 2,2n -k 3,3n| tail -1) + collectionVersion=$(git ls-remote $repository --tags v9.5\* | grep tags/ | grep -v {} | cut -d \/ -f 3 | cut -d v -f 2 | grep -v RC | grep -vi beta | sort -t. -k 1,1n -k 2,2n -k 3,3n| tail -1) else collectionVersion=$requestedVersion fi