(bug 22647) Add category details in search results. Contributed by Lejonel.
[lhc/web/wiklou.git] / includes / WebRequest.php
index 15126a3..834f2b1 100644 (file)
@@ -624,7 +624,8 @@ class WebRequest {
        public function response() {
                /* Lazy initialization of response object for this request */
                if ( !is_object( $this->_response ) ) {
-                       $this->_response = new WebResponse;
+                       $class = ( $this instanceof FauxRequest ) ? 'FauxResponse' : 'WebResponse';
+                       $this->_response = new $class();
                }
                return $this->_response;
        }
@@ -712,6 +713,7 @@ class WebRequest {
 class FauxRequest extends WebRequest {
        private $wasPosted = false;
        private $session = array();
+       private $response;
 
        /**
         * @param $data Array of *non*-urlencoded key => value pairs, the
@@ -762,18 +764,20 @@ class FauxRequest extends WebRequest {
                return isset( $this->headers[$name] ) ? $this->headers[$name] : false;
        }
 
+       public function setHeader( $name, $val ) {
+               $this->headers[$name] = $val;
+       }
+
        public function getSessionData( $key ) {
-               if( !isset( $this->session[$key] ) )
-                       return null;
-               return $this->session[$key];
+               if( isset( $this->session[$key] ) )
+                       return $this->session[$key];
        }
 
        public function setSessionData( $key, $data ) {
-               $this->notImplemented( __METHOD__ );
+               $this->session[$key] = $data;
        }
 
        public function isPathInfoBad() {
                return false;
        }
-
 }