mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-24 02:55:30 +00:00
[constant-trickery] Reimport class definition to clear static variables.
This commit is contained in:
parent
3c75fa1ad4
commit
f62a9114b3
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user