[constant-trickery] Try to use runkit to redefine mode constants.

This commit is contained in:
Andreas Fischer 2013-01-12 03:03:29 +01:00
parent 55e9f4d7ef
commit 306f0711ed

View File

@ -20,6 +20,19 @@ abstract class PhpseclibTestCase extends PHPUnit_Framework_TestCase
$value = constant($constant);
if ($value !== $expected)
{
if (function_exists('runkit_constant_redefine'))
{
if (!runkit_constant_redefine($constant, $expected))
{
self::markTestSkipped(sprintf(
"Failed to redefine mode constant %s to %s",
$constant,
$expected
));
}
}
else
{
self::markTestSkipped(sprintf(
"Skipping test because mode constant %s is %s instead of %s",
@ -29,6 +42,7 @@ abstract class PhpseclibTestCase extends PHPUnit_Framework_TestCase
));
}
}
}
else
{
define($constant, $expected);