Example #1
0
 public static function setup($rootDir)
 {
     // configure environment
     umask(0);
     Tester\Environment::setup();
     class_alias('Tester\\Assert', 'Assert');
     date_default_timezone_set('Europe/Prague');
     // create temporary directory
     define('TEMP_DIR', $rootDir . '/tmp/' . (isset($_SERVER['argv']) ? md5(serialize($_SERVER['argv'])) : getmypid()));
     Tester\Helpers::purge(TEMP_DIR);
     @chmod(TEMP_DIR, 0777);
     Nette\Diagnostics\Debugger::$logDirectory = TEMP_DIR;
     $_SERVER = array_intersect_key($_SERVER, array_flip(array('PHP_SELF', 'SCRIPT_NAME', 'SERVER_ADDR', 'SERVER_SOFTWARE', 'HTTP_HOST', 'DOCUMENT_ROOT', 'OS', 'argc', 'argv')));
     $_SERVER['REQUEST_TIME'] = 1234567890;
     $_ENV = $_GET = $_POST = $_FILES = array();
     if (extension_loaded('xdebug')) {
         xdebug_disable();
         Tester\CodeCoverage\Collector::start($rootDir . '/coverage.dat');
     }
 }
Example #2
0
<?php

namespace Medio;

use Tester;
use Tester\CodeCoverage\Collector;
require __DIR__ . '/../vendor/autoload.php';
if (extension_loaded('xdebug')) {
    Collector::start(__DIR__ . '/coverage.dat');
}
function test(\Closure $function)
{
    $function();
}
Tester\Environment::setup();