mirror of
https://github.com/danog/tgseclib.git
synced 2024-11-27 04:34:45 +01:00
[constant-trickery] Provide infrastructure for setting mode constants.
This commit is contained in:
parent
2c3b165556
commit
2ad6f71002
@ -7,5 +7,31 @@
|
||||
|
||||
abstract class PhpseclibTestCase extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @param string $constant
|
||||
* @param mixed $expected
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
static protected function ensureModeConstant($constant, $expected)
|
||||
{
|
||||
if (defined($constant))
|
||||
{
|
||||
$value = constant($constant);
|
||||
|
||||
if ($value !== $expected)
|
||||
{
|
||||
self::markTestSkipped(sprintf(
|
||||
"Skipping test because mode constant %s is %s instead of %s",
|
||||
$constant,
|
||||
$value,
|
||||
$expected
|
||||
));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
define($constant, $expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user