Skip to content

Commit

Permalink
Fix the data provider to test both Gmp and BCMath when both extension…
Browse files Browse the repository at this point in the history
…s are installed (#189)
  • Loading branch information
stof authored Feb 23, 2023
1 parent c42c4c5 commit 06a1dd0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/MathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ class MathTest extends TestCase
{
public static function mathProvider()
{
$providerCases = [];
if (extension_loaded('gmp')) {
return [
[new Gmp()]
];
$providerCases[] = [new Gmp()];
}

if (extension_loaded('bcmath')) {
return [
[new BCMath()]
];
$providerCases[] = [new BCMath()];
}

if (count($providerCases) > 0) {
return $providerCases;
}

throw new RuntimeException('Missing math extension for Hashids, install either bcmath or gmp.');
Expand Down

0 comments on commit 06a1dd0

Please sign in to comment.