2014-03-03 00:34:43 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @author Andreas Fischer <bantu@phpbb.com>
|
2014-12-09 23:02:44 +00:00
|
|
|
* @copyright 2014 Andreas Fischer
|
2014-03-03 00:34:43 +00:00
|
|
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
|
|
|
*/
|
|
|
|
|
2014-12-17 00:16:54 +00:00
|
|
|
|
2014-03-03 00:34:43 +00:00
|
|
|
abstract class PhpseclibFunctionalTestCase extends PhpseclibTestCase
|
|
|
|
{
|
|
|
|
/**
|
2015-03-29 16:07:17 +00:00
|
|
|
* @param string $variable
|
|
|
|
* @param string|null $message
|
|
|
|
*
|
|
|
|
* @return null
|
|
|
|
*/
|
2014-03-03 00:34:43 +00:00
|
|
|
protected function requireEnv($variable, $message = null)
|
|
|
|
{
|
|
|
|
if ($this->_getEnv($variable) === false) {
|
|
|
|
$msg = $message ? $message : sprintf(
|
|
|
|
"This test requires the '%s' environment variable.",
|
|
|
|
$this->_prefixEnvVariable($variable)
|
|
|
|
);
|
|
|
|
$this->markTestSkipped($msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2015-03-29 16:07:17 +00:00
|
|
|
* @param string $variable
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2014-03-03 00:34:43 +00:00
|
|
|
protected function getEnv($variable)
|
|
|
|
{
|
|
|
|
$this->requireEnv($variable);
|
|
|
|
return $this->_getEnv($variable);
|
|
|
|
}
|
|
|
|
|
|
|
|
private function _getEnv($variable)
|
|
|
|
{
|
|
|
|
return getenv($this->_prefixEnvVariable($variable));
|
|
|
|
}
|
|
|
|
|
|
|
|
private function _prefixEnvVariable($variable)
|
|
|
|
{
|
|
|
|
return 'PHPSECLIB_' . $variable;
|
|
|
|
}
|
|
|
|
}
|