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;
}
class FauxRequest extends WebRequest {
private $wasPosted = false;
private $session = array();
+ private $response;
/**
* @param $data Array of *non*-urlencoded key => value pairs, the
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;
}
-
}