* [ADD] Unit testing. Work in progress

This commit is contained in:
nuxsmin
2018-07-21 12:41:20 +02:00
parent 5be9963892
commit 375b69fc41
2 changed files with 129 additions and 28 deletions

View File

@@ -44,7 +44,8 @@ define('CONFIG_FILE', CONFIG_PATH . DIRECTORY_SEPARATOR . 'config.xml');
define('ACTIONS_FILE', CONFIG_PATH . DIRECTORY_SEPARATOR . 'actions.xml');
define('CACHE_PATH', RESOURCE_DIR . DIRECTORY_SEPARATOR . 'cache');
define('LOG_FILE', TMP_DIR . DIRECTORY_SEPARATOR . 'test.log');
define('SELF_IP_ADDRESS', '172.17.0.4');
define('SELF_IP_ADDRESS', getRealIpAddress());
define('SELF_HOSTNAME', gethostbyaddr(SELF_IP_ADDRESS));
require APP_ROOT . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
require APP_ROOT . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'BaseFunctions.php';
@@ -67,6 +68,14 @@ if (!function_exists('\gettext')) {
}
}
/**
* @return string
*/
function getRealIpAddress()
{
return trim(shell_exec('ip a s eth0 | awk \'$1 == "inet" {print $2}\' | cut -d"/" -f1'));
}
/**
* Configura el contexto de la aplicación para los tests
*