diff --git a/tests/Math/BigInteger/BCMathTest.php b/tests/Math/BigInteger/BCMathTest.php index 6440550b..08d4b3fe 100644 --- a/tests/Math/BigInteger/BCMathTest.php +++ b/tests/Math/BigInteger/BCMathTest.php @@ -14,7 +14,8 @@ class Math_BigInteger_BCMathTest extends Math_BigInteger_TestCase self::markTestSkipped('BCMath extension is not available.'); } - self::ensureModeConstant('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_BCMATH); parent::setUpBeforeClass(); + + self::ensureModeConstant('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_BCMATH); } } diff --git a/tests/Math/BigInteger/GMPTest.php b/tests/Math/BigInteger/GMPTest.php index c8895271..fcd898d1 100644 --- a/tests/Math/BigInteger/GMPTest.php +++ b/tests/Math/BigInteger/GMPTest.php @@ -14,7 +14,8 @@ class Math_BigInteger_GMPTest extends Math_BigInteger_TestCase self::markTestSkipped('GNU Multiple Precision (GMP) extension is not available.'); } - self::ensureModeConstant('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_GMP); parent::setUpBeforeClass(); + + self::ensureModeConstant('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_GMP); } } diff --git a/tests/Math/BigInteger/InternalTest.php b/tests/Math/BigInteger/InternalTest.php index dcdc9129..1ca2ef74 100644 --- a/tests/Math/BigInteger/InternalTest.php +++ b/tests/Math/BigInteger/InternalTest.php @@ -9,7 +9,8 @@ class Math_BigInteger_InternalTest extends Math_BigInteger_TestCase { static public function setUpBeforeClass() { - self::ensureModeConstant('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_INTERNAL); parent::setUpBeforeClass(); + + self::ensureModeConstant('MATH_BIGINTEGER_MODE', MATH_BIGINTEGER_MODE_INTERNAL); } } diff --git a/tests/Math/BigInteger/TestCase.php b/tests/Math/BigInteger/TestCase.php index 74a92663..01edc475 100644 --- a/tests/Math/BigInteger/TestCase.php +++ b/tests/Math/BigInteger/TestCase.php @@ -9,6 +9,13 @@ require_once 'Math/BigInteger.php'; abstract class Math_BigInteger_TestCase extends PhpseclibTestCase { + static public function setUpBeforeClass() + { + parent::setUpBeforeClass(); + + self::reRequireFile('Math/BigInteger.php'); + } + public function getInstance($x = 0, $base = 10) { return new Math_BigInteger($x, $base); diff --git a/tests/PhpseclibTestCase.php b/tests/PhpseclibTestCase.php index 196e87dd..e69aa25a 100644 --- a/tests/PhpseclibTestCase.php +++ b/tests/PhpseclibTestCase.php @@ -48,4 +48,27 @@ abstract class PhpseclibTestCase extends PHPUnit_Framework_TestCase define($constant, $expected); } } + + /** + * @param string $filename + * + * @return null + */ + static protected function reRequireFile($filename) + { + if (function_exists('runkit_import')) + { + $result = runkit_import( + $filename, + RUNKIT_IMPORT_FUNCTIONS | + RUNKIT_IMPORT_CLASS_METHODS | + RUNKIT_IMPORT_OVERRIDE + ); + + if (!$result) + { + self::markTestSkipped("Failed to reimport file $filename"); + } + } + } }