예제 #1
0
 public static function init($uri, $method, array $params = array(), array $options = array())
 {
     self::reset();
     $uri = parse_url($uri);
     $method = strtoupper($method);
     $_SERVER['REQUEST_URI'] = $uri;
     $_SERVER['REQUEST_METHOD'] = $method;
     if (isset($uri['query'])) {
         $_SERVER['QUERY_STRING'] = $uri['query'];
         parse_str($uri['query'], $_GET);
     }
     if ($method != 'GET') {
         $_POST = $params;
     }
     if (isset($options['ajax']) && $options['ajax']) {
         self::useAjax();
     }
     if (isset($options['header'])) {
         foreach ($options['header'] as $key => $val) {
             self::setHeader($key, $val);
         }
     }
     $_COOKIE = \Test\Mock\Cookie::instance()->get($uri['path']);
     $_REQUEST = array_merge($_GET, $_POST, $_COOKIE);
 }
예제 #2
0
파일: Response.php 프로젝트: lryl/Lysine2
 public function setCookie($name, $value, $expire = 0, $path = '/', $domain = null, $secure = false, $httponly = true)
 {
     \Test\Mock\Cookie::instance()->set($name, $value, $expire, $path, $domain, $secure, $httponly);
 }