Exemplo n.º 1
0
function init($confFiles)
{
    addLibsDirToIncludePath();
    requireStandardLibs();
    $conf = readConfig($confFiles);
    $e = trim(at($conf, 'admin.email'));
    if (empty($e) && APPLICATION_ENV != 'development') {
        echo "Configuration parameter admin.email is not set! This is necessary to ensure " . "someone is notified of any errors that occur.";
        exit(-1);
    }
    error_reporting(E_ALL);
    ini_set('display_errors', APPLICATION_ENV == 'development');
    require_once 'spare-parts/error-handling.php';
    \SpareParts\ErrorHandling\initErrorHandling($e);
    require_once 'chipin/env/log.php';
    \Chipin\Log\configure();
    # To make PHP shut-up regarding a default time-zone not being set.
    date_default_timezone_set("America/New_York");
    $dbParam = function ($p) use($conf) {
        return $conf['resources.db.params.' . $p];
    };
    DB\setConnectionParams($driver = 'mysql', $dbName = $dbParam('dbname'), $username = $dbParam('username'), $password = $dbParam('password'), $host = $dbParam('host'));
    if (APPLICATION_ENV == 'development') {
        require_once 'chipin/debug.php';
    }
}
Exemplo n.º 2
0
function main($argc, $argv)
{
    $testDir = realpath(dirname(__FILE__));
    $libsDir = realpath(dirname($testDir) . '/lib');
    set_include_path($libsDir . PATH_SEPARATOR . get_include_path());
    set_include_path(dirname(__FILE__) . '/mock/lib' . PATH_SEPARATOR . get_include_path());
    error_reporting(E_ALL);
    require_once 'chipin/env/log.php';
    //  \Chipin\Log\configure();
    require_once 'spare-parts/database.php';
    DB\setConnectionParams($driver = 'mysql', $dbName = 'chipin_test', $username = '******', $password = '******', $host = 'localhost');
    require_once 'spare-parts/test/mock-sendmail.php';
    Test\MockEmail\addMockSendmailToPath(dirname(__FILE__) . '/mock/bin/mock-sendmail');
    require_once 'spare-parts/test/base-framework.php';
    $filesToIgnore = array('test.php', 'config.ini', 'mock/bin/mock-sendmail', 'lib/chipin/env/conf1.ini', 'lib/chipin/env/conf2.ini');
    Test\testScriptMain($testDir, $filesToIgnore, $argc, $argv);
}