From 3de744597e346550998fb4f84bf5a2504668a8ae Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Wed, 31 Jan 2018 23:05:20 -0800 Subject: [PATCH] Fix invocation of MWHttpRequest::factory with one argument. Change-Id: Ib96c2888a6fd91ca80c162a80d283f650d6fa4b9 --- includes/http/MWHttpRequest.php | 2 +- tests/integration/includes/http/MWHttpRequestTestCase.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/http/MWHttpRequest.php b/includes/http/MWHttpRequest.php index fff72ec09f..ac16032ca3 100644 --- a/includes/http/MWHttpRequest.php +++ b/includes/http/MWHttpRequest.php @@ -181,7 +181,7 @@ abstract class MWHttpRequest implements LoggerAwareInterface { * @return MWHttpRequest * @see MWHttpRequest::__construct */ - public static function factory( $url, $options = null, $caller = __METHOD__ ) { + public static function factory( $url, array $options = [], $caller = __METHOD__ ) { return \MediaWiki\MediaWikiServices::getInstance() ->getHttpRequestFactory() ->create( $url, $options, $caller ); diff --git a/tests/integration/includes/http/MWHttpRequestTestCase.php b/tests/integration/includes/http/MWHttpRequestTestCase.php index 3b02e28b44..cc769d7ee8 100644 --- a/tests/integration/includes/http/MWHttpRequestTestCase.php +++ b/tests/integration/includes/http/MWHttpRequestTestCase.php @@ -195,6 +195,11 @@ abstract class MWHttpRequestTestCase extends PHPUnit_Framework_TestCase { $this->assertSame( 401, $request->getStatus() ); } + public function testFactoryDefaults() { + $request = MWHttpRequest::factory( 'http://acme.test' ); + $this->assertInstanceOf( MWHttpRequest::class, $request ); + } + // -------------------- /** @@ -242,4 +247,5 @@ abstract class MWHttpRequestTestCase extends PHPUnit_Framework_TestCase { $this->assertArrayNotHasKey( strtolower( $name ), array_change_key_case( $cookieJar->cookie, CASE_LOWER ) ); } + } -- 2.20.1