예제 #1
0
<?php

namespace Ilex\Test;

ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
ini_set('display_errors', 1);
ini_set('html_errors', 0);
session_cache_expire(240);
require_once __DIR__ . '/../../../autoload.php';
require_once __DIR__ . '/ValidatorTester.php';
use Exception;
use Ilex\Tester;
use Ilex\Core\Debug;
use Ilex\Lib\Kit;
use Ilex\Test\ValidatorTester as VT;
try {
    Tester::boot(__DIR__ . '/app', __DIR__ . '/runtime', 'app');
    // VT::test('countCollection');
    // echo 'Validator Test Passed.' . PHP_EOL;
} catch (Exception $e) {
    echo Kit::j(Debug::extractException($e));
}
예제 #2
0
 /**
  * Set code from NULL/1/2 to 0.
  * @param int       $execution_id
  * @param array     $execution_record
  * @param Exception $exception
  */
 private final function failRequest($execution_id, $execution_record, Exception $exception)
 {
     $code = $this->getCode();
     if (FALSE === is_null($code) and FALSE === Kit::in($code, [1, 2])) {
         throw new UserException('Can not fail the request because of invalid code.', $code, $exception);
     }
     // Now code must be NULL or 1 or 2.
     $this->setCode(0);
     if (FALSE === Debug::isProduction()) {
         $this->result['exception'] = Debug::extractException($exception);
         $this->result['mainException'] = Debug::extractMainException($this->result['exception']);
     }
     $execution_record['success'] = FALSE;
     $this->respond($execution_id, $execution_record, 200);
     // @TODO: change code
 }