[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

@ -21,12 +21,26 @@ abstract class PhpseclibTestCase extends PHPUnit_Framework_TestCase
if ($value !== $expected)
{
self::markTestSkipped(sprintf(
"Skipping test because mode constant %s is %s instead of %s",
$constant,
$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",
$constant,
$value,
$expected
));
}
}
}
else