From 06a1dd09f79fa07d020bd30469d4996614db315f Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Thu, 23 Feb 2023 10:26:50 +0100 Subject: [PATCH] Fix the data provider to test both Gmp and BCMath when both extensions are installed (#189) --- tests/MathTest.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/MathTest.php b/tests/MathTest.php index 168cd79..667821c 100644 --- a/tests/MathTest.php +++ b/tests/MathTest.php @@ -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.');