Skip to content

Commit

Permalink
BUGFIX: Fix PHP 8.1 compatibility in test base classes
Browse files Browse the repository at this point in the history
  • Loading branch information
bwaidelich committed Aug 3, 2023
1 parent 2e9cfcb commit 94fdc5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 3 additions & 4 deletions tests/Integration/EventStoreConcurrencyTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\TestCase;
use Random\Randomizer;
use Wwwision\DCBEventStore\EventStore;
use Wwwision\DCBEventStore\Exceptions\ConditionalAppendFailed;
use Wwwision\DCBEventStore\Types\AppendCondition;
Expand Down Expand Up @@ -37,6 +36,7 @@
use function min;
use function random_int;
use function range;
use function shuffle;
use function sprintf;
use const JSON_THROW_ON_ERROR;

Expand Down Expand Up @@ -165,10 +165,9 @@ private static function either(...$choices): mixed
*/
private static function some(int $max, ...$choices): array
{
$randomizer = new Randomizer();
$amount = self::between(1, min($max, count($choices)));
$shuffledChoices = $randomizer->shuffleArray($choices);
return array_slice($shuffledChoices, 0, $amount);
shuffle($choices);
return array_slice($choices, 0, $amount);
}

private static function between(int $min, int $max): int
Expand Down
2 changes: 0 additions & 2 deletions tests/Integration/EventStoreTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
use PHPUnit\Framework\TestCase;
use function array_keys;
use function array_map;
use function get_debug_type;
use function getenv;
use function in_array;
use function range;

Expand Down

0 comments on commit 94fdc5a

Please sign in to comment.