#!/usr/bin/env php
<?php
define('MODE','test');
$host=$_ENV['M_HOST'];
if(empty($host)) throw new Exception('You must set shell ENV variable M_HOST to desired host before launching tests');
$app=$_ENV['M_APP'];
if(empty($app)) {
	echo '//////////////// WARNING ////////////////
M_APP not defined, using office as default
///////////////////////////////////////////
	';
	$app='office';
	}
define('APP_NAME',$app);

include trim(`pwd`).'/M_startup.php';
Mreg::get('setup')->setUpEnv();

require_once 'PHP/CodeCoverage/Filter.php';
PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'PHPUNIT');

if (strpos('/Applications/MAMP/bin/php/php5.3.6/bin/php', '@php_bin') === 0) {
    set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
}
@ini_set('memory_limit','1024M');
require_once 'PHPUnit/Autoload.php';

define('PHPUnit_MAIN_METHOD', 'PHPUnit_TextUI_Command::main');

PHPUnit_TextUI_Command::main();
