r62233 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62232‎ | r62233 | r62234 >
Date:10:49, 10 February 2010
Author:demon
Status:ok
Tags:
Comment:
Followup r62231, reduce code duplication in $request->response()
Modified paths:
  • /trunk/phase3/includes/WebRequest.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/WebRequest.php
@@ -624,7 +624,8 @@
625625 public function response() {
626626 /* Lazy initialization of response object for this request */
627627 if ( !is_object( $this->_response ) ) {
628 - $this->_response = new WebResponse;
 628+ $class = ( $this instanceof FauxRequest ) ? 'FauxResponse' : 'WebResponse';
 629+ $this->_response = new $class();
629630 }
630631 return $this->_response;
631632 }
@@ -779,12 +780,4 @@
780781 public function isPathInfoBad() {
781782 return false;
782783 }
783 -
784 - public function response() {
785 - /* Lazy initialization of response object for this request */
786 - if ( !is_object( $this->response ) ) {
787 - $this->response = new FauxResponse;
788 - }
789 - return $this->response;
790 - }
791784 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r62231* new FauxResponse class to help with unit testing...mah10:36, 10 February 2010

Status & tagging log