public function testError_exc() { PWELogger::setStdErr("php://stdout"); PWELogger::error("Errors are bad: %s", new ExceptionExpected()); PWELogger::debug(new ExceptionExpected()); }
<?php if ($_SERVER['SERVER_ADDR'] == $_SERVER['REMOTE_ADDR']) { $level = \PWE\Core\PWELogger::DEBUG; } else { $level = \PWE\Core\PWELogger::WARNING; } $logfile = sys_get_temp_dir() . "/pwe.log"; $tempdir = sys_get_temp_dir(); \PWE\Core\PWELogger::setStdErr($logfile); \PWE\Core\PWELogger::setStdOut($logfile); \PWE\Core\PWELogger::setLevel($level); /** @var $PWECore PWE\Core\PWECore */ $PWECore->setRootDirectory(__DIR__); $PWECore->setXMLDirectory($PWECore->getDataDirectory()); $PWECore->setTempDirectory($tempdir);
<?php use PWE\Core\PWEAutoloader; use PWE\Core\PWECore; use PWE\Core\PWELogger; use PWE\Exceptions\PHPFatalException; use PWE\Utils\FilesystemHelper; error_reporting(E_ALL ^ E_NOTICE); $src = __DIR__ . '/..'; require_once $src . '/PWE/Core/PWELogger.php'; require_once $src . '/PWE/Core/PWEAutoloader.php'; PWELogger::setStdOut('php://stdout'); PWELogger::setStdErr('php://stdout'); PWELogger::setLevel(PWELogger::DEBUG); PWEAutoloader::addSourceRoot(__DIR__); PWEAutoloader::addSourceRoot(__DIR__ . '/..'); PWEAutoloader::addSourceRoot(__DIR__ . '/../../vendor/'); PWEAutoloader::addSourceRoot('/usr/share/php'); PWEAutoloader::activate(); require_once __DIR__ . '/../PWE/Utils/FilesystemHelper.php'; PHPFatalException::activate(); set_time_limit(180); $_SERVER["DOCUMENT_ROOT"] = dirname($_SERVER["SCRIPT_FILENAME"]); //require_once __DIR__ . '/PWE/Core/UnitTestPWECore.php'; class PWEUnitTests { public static function dumpArrayToFile($arr2, $toFile) { ob_start(); print_r($arr2); file_put_contents($toFile, ob_get_contents());