Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
Merge pull request #344 from tighten/v9.52.5-changes
Browse files Browse the repository at this point in the history
v9.52.5 changes
  • Loading branch information
jamisonvalenta authored Apr 14, 2023
2 parents d4772fe + 775ecd2 commit b15143c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Collect/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
11 changes: 11 additions & 0 deletions tests/Support/SupportArrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -817,6 +823,11 @@ public function testShuffleWithSeed()
);
}

public function testEmptyShuffle()
{
$this->assertEquals([], Arr::shuffle([]));
}

public function testSort()
{
$unsorted = [
Expand Down
2 changes: 2 additions & 0 deletions tests/Support/SupportCollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4682,6 +4682,7 @@ public function testCollectionFromTraversableWithKeys($collection)

/**
* @dataProvider collectionClassProvider
*
* @requires PHP >= 8.1
*/
public function testCollectionFromEnum($collection)
Expand All @@ -4692,6 +4693,7 @@ public function testCollectionFromEnum($collection)

/**
* @dataProvider collectionClassProvider
*
* @requires PHP >= 8.1
*/
public function testCollectionFromBackedEnum($collection)
Expand Down
2 changes: 1 addition & 1 deletion tests/files/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b15143c

Please sign in to comment.