public static function setup($tempDir, $callback = NULL) { if (!class_exists('Tester\\Assert')) { echo "Install Nette Tester using `composer update --dev`\n"; exit(1); } self::$tempDir = $tempDir; self::$onBeforeContainerCreate = $callback; umask(0); \Tester\Environment::setup(); date_default_timezone_set('Europe/Prague'); if (class_exists('Tracy\\Debugger')) { \Tracy\Debugger::$logDirectory = self::$tempDir; } $_ENV = $_GET = $_POST = $_FILES = []; }
public static function setup($tempDir, $callback = NULL) { if (!class_exists('Tester\\Assert')) { echo "Install Nette Tester using `composer update --dev`\n"; exit(1); } self::$tempDir = $tempDir; self::$onBeforeContainerCreate = $callback; umask(0); if (!ob_get_level() > 0) { //\Tester\Environment::setup already called \Tester\Environment::setup(); } date_default_timezone_set('Europe/Prague'); if (class_exists('Tracy\\Debugger')) { \Tracy\Debugger::$logDirectory = self::$tempDir; } $_ENV = $_GET = $_POST = $_FILES = []; $_SERVER['HTTP_USER_AGENT'] = 'Awesome Browser'; $_SERVER['REMOTE_ADDR'] = '11.22.33.44'; $_SERVER['HTTP_HOST'] = $_SERVER['SERVER_NAME'] = 'test.bench'; }
<?php if (@(!(include __DIR__ . '/../vendor/autoload.php'))) { echo 'Install Nette Tester using `composer update --dev`'; exit(1); } // configure environment Tester\Environment::setup(); class_alias('Tester\\Assert', 'Assert'); date_default_timezone_set('Europe/Prague'); // create temporary directory define('TEMP_DIR', __DIR__ . '/../tmp/' . (isset($_SERVER['argv']) ? md5(serialize($_SERVER['argv'])) : getmypid())); Tester\Helpers::purge(TEMP_DIR); Tracy\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 = array(); function test(\Closure $function) { $function(); }
<?php require __DIR__ . '/../vendor/autoload.php'; if (!class_exists('Tester\\Assert')) { echo "Install Nette Tester using `composer update --dev`\n"; exit(1); } Tester\Environment::setup(); $configurator = new Nette\Configurator(); $configurator->setDebugMode(!FALSE); Tracy\Debugger::$logDirectory = __DIR__ . '/../log'; //$configurator->enableDebugger(__DIR__ . '/../log'); $configurator->setTempDirectory(__DIR__ . '/../temp'); $configurator->createRobotLoader()->addDirectory(__DIR__ . '/../src')->addDirectory(__DIR__ . '/Mock')->addDirectory(__DIR__ . '/app')->register(); $configurator->addConfig(__DIR__ . '/config/config.neon'); $configurator->addConfig(__DIR__ . '/config/config.local.neon'); return $configurator->createContainer();