From: Brion Vibber Date: Thu, 2 Sep 2004 02:23:49 +0000 (+0000) Subject: Add FauxRequest class for arbitrary parameters. X-Git-Tag: 1.5.0alpha1~2169 X-Git-Url: http://git.cyclocoop.org/url?a=commitdiff_plain;h=4e3ccb6d70cfca2084e20bbc2f12f74c0091ee2a;p=lhc%2Fweb%2Fwiklou.git Add FauxRequest class for arbitrary parameters. --- diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 841ce29f0f..a37c257bb4 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -163,4 +163,48 @@ class WebRequest { } } +class FauxRequest extends WebRequest { + var $data = null; + var $wasPosted = false; + + function WebRequest( $data, $wasPosted = false ) { + if( is_array( $data ) ) { + $this->data = $data; + } else { + wfDebugDieBacktrace( "FauxReqeust() got bogus data" ); + } + $this->wasPosted = $wasPosted; + } + + function getVal( $name, $default = NULL ) { + return $this->getGPCVal( $this->data, $name, $default ); + } + + function getText( $name, $default = '' ) { + # Override; don't recode since we're using internal data + return $this->getVal( $name, $default ); + } + + function getValues() { + return $this->data; + } + + function wasPosted() { + return $this->wasPosted; + } + + function checkSessionCookie() { + return false; + } + + function getRequestURL() { + wfDebugDieBacktrace( 'FauxRequest::getRequestURL() not implemented' ); + } + + function appendQuery( $query ) { + wfDebugDieBacktrace( 'FauxRequest::appendQuery() not implemented' ); + } + +} + ?>