Ejemplo n.º 1
0
<?php

require __DIR__ . '/../vendor/nette/tester/Tester/bootstrap.php';
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../src/interfaces/IApiUser.php';
require __DIR__ . '/../src/interfaces/IApiAuthenticator.php';
require __DIR__ . '/../src/interfaces/IApiLogger.php';
require __DIR__ . '/../src/RestRoute.php';
require __DIR__ . '/../src/ApiResponse.php';
require __DIR__ . '/../src/ApiPresenter.php';
require __DIR__ . '/../src/JsonSchemaValidator.php';
Nette\Diagnostics\Debugger::$logDirectory = __DIR__ . '/output';
function d($v)
{
    echo \Tester\Dumper::toPhp($v) . "\n";
}
Ejemplo n.º 2
0
	public function setup()
	{
		$file = "_file_action_logger_test_" . time() . ".log";
		$this->file = (\Nette\Diagnostics\Debugger::$logDirectory = __DIR__ . "/..") . "/" . $file;
		$this->logger = new FileStorage(new \Nette\Security\Identity(1), $file);
	}
Ejemplo n.º 3
0
}
$loader->add('JedenWeb', __DIR__ . '/../../libs');
require_once __DIR__ . '/../../src/JedenWeb/common/Configurator.php';
// configure environment
Tester\Helpers::setup();
class_alias('Tester\\Assert', 'Assert');
date_default_timezone_set('Europe/Prague');
// create temporary directory
define('TEMP_DIR', __DIR__ . '/../temp/' . getmypid());
@mkdir(dirname(TEMP_DIR));
// @ - directory may already exist
Tester\Helpers::purge(TEMP_DIR);
define('LOG_DIR', __DIR__ . '/../log/');
@mkdir(dirname(LOG_DIR));
// @ - directory may already exist
Nette\Diagnostics\Debugger::$logDirectory = LOG_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();
if (extension_loaded('xdebug')) {
    xdebug_disable();
    Tester\CodeCoverage\Collector::start(__DIR__ . '/coverage.dat');
}
function id($val)
{
    return $val;
}
if (!class_exists('Notes')) {
    class Notes
    {
        public static $notes = array();
Ejemplo n.º 4
0
<?php

include __DIR__ . '/../../libs/autoload.php';
if (!class_exists('Tester\\Assert')) {
    echo "Install Nette Tester using `composer update --dev`\n";
    exit(1);
}
if (extension_loaded('xdebug')) {
    xdebug_disable();
    Tester\CodeCoverage\Collector::start(__DIR__ . '/coverage.dat');
}
function run(Tester\TestCase $testCase)
{
    $testCase->run(isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : NULL);
}
// configure environment
Tester\Helpers::setup();
date_default_timezone_set('Europe/Prague');
define('APP_DIR', __DIR__ . '/../../app');
// create temporary directory
define('TEMP_DIR', __DIR__ . '/../temp/' . (isset($_SERVER['argv']) ? md5(serialize($_SERVER['argv'])) : getmypid()));
Tester\Helpers::purge(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();
$logDir = __DIR__ . '/../log';
\Nette\Diagnostics\Debugger::$logDirectory = $logDir;
\Nette\Diagnostics\Debugger::$productionMode = false;