aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/http/HttpTest.php
Commit message (Collapse)AuthorAgeFilesLines
* Remove deprecated class HttpUmherirrender2023-04-241-32/+0
| | | | | | | | | | | | | | The class and all functions are deprecated: - Http::request() - Http::get() - Http::post() - Http::userAgent() - Http::isValidURI() - Http::getProxy() - Http::createMultiClient() Bug: T305813 Change-Id: Icd8af4822b16b4bf4558b756e20171c3ae9a9fa1
* Migrate usage of `setMwGlobals()` to `overrideConfigValue(s)`Derick Alangi2022-08-011-2/+4
| | | | Change-Id: I49d97864d8f9d8cadf01b0c0dc653fbac4ca9e94
* MediaWikiTestCase to MediaWikiIntegrationTestCaseaddshore2020-06-301-1/+1
| | | | | | | | | | | | | The name change happened some time ago, and I think its about time to start using the name name! (Done with a find and replace) My personal motivation for doing this is that I have started trying out vscode as an IDE for mediawiki development, and right now it doesn't appear to handle php aliases very well or at all. Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
* tests: Prefer PHPUnit's assertSame() when comparing empty stringsThiemo Kreuz2019-09-201-1/+1
| | | | | | | | assertSame() is guaranteed to never do any magic type conversion. This can be critical when accidentially comparing empty strings (a value PHP considers to be "falsy") to false, 0, 0.0, null, and such. Change-Id: I2e2685c5992cae252f629a68ffe1a049f2e5ed1b
* Split HttpTest and SessionTest to unit and integrationAmir Sarabadani2019-07-131-81/+0
| | | | | | | This way it moves 73 more tests to unit tests Bug: T87781 Change-Id: I963488450bb355573d71ae31b57d71683ce51683
* Add tests for HttpRequestFactoryTest.daniel2019-05-131-448/+1
| | | | | | | | This also moves several tests out of HttpTest, so they are not lost when the deprecated Http class is removed. Bug: T222935 Change-Id: Ib4aac96ba1a978e8b6738ed446663afc3cc8c792
* Deprecate the Http classAryeh Gregor2019-05-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | All methods got moved to HttpRequestFactory or MWHttpRequest or dropped. I made the return value of the new HttpRequestFactory::request/get/post methods null on error instead of false, so that when we drop PHP 7 support, we can use a "?string" return value. This could theoretically change behavior of code that was switched from the old Http methods, but probably won't. I kept the old behavior for the deprecated methods. I changed the default value of $wgHTTPProxy from false to ''. This way it should be usable directly without a trivial wrapper method. For the benefit of anyone who might have set it to false in LocalSettings.php, I also recommend casting to string just in case. Http::$httpEngine is deprecated. Eventually it will be removed along with the curl and PHP engines, leaving only the Guzlle engine. I also added deprecation of MWHttpRequest::factory, which occurred in 1.31, to the release notes for 1.34. Now hopefully we can hard-deprecate it in another couple of versions. Bug: T214390 Change-Id: I2a316a758d793857f248bd251b90f5e9a6440e3a
* Use https://www.php.net/ instead of https://secure.php.net/Fomafix2019-04-121-3/+3
| | | | Change-Id: I0acca592c6909e91b28b904da49dcbd6a43cd2a5
* http: Support callback functions in GuzzleHttpRequestBill Pirkle2019-01-241-16/+0
| | | | | | | | | | Provide backward compatibility for callback functions in GuzzleHttpRequest, which was missing in T202110, and restore GuzzleHttpRequest as the default provided by HttpRequestFactory. Bug: T212175 Depends-On: I4b45e79d35252d13f714f3271b87301ca515121a Change-Id: I60d1a034b44874f6d24a04058db264eeb565f5e1
* Create GuzzleHttpRequest class as new default for HttpRequestFactoryBill Pirkle2018-12-101-1/+25
| | | | | | | | | | | Create a GuzzleHttpRequest class using the external Guzzle (docs.guzzlephp.org) library. This will be the new default request type, but CurlHttpRequest and PhpHttpRequest remain available and accessible via Http::$httpEngine. Bug: T202110 Change-Id: Ie720be2628d7baf427b002847f103fd86ee4cff3 Depends-On: I143a6410d111e75f01dbbfd43f300e2e60247451
* Replace HTTP by HTTPSFomafix2018-05-221-3/+3
| | | | | | | | | | | * https://www.unicode.org/ instead of http://www.unicode.org/ or http://unicode.org/ * https://secure.php.net/ instead of http://www.php.net/ or http://php.net/ * https://hhvm.com/ instead of http://hhvm.com/ * https://www.iis.net/ instead of http://www.iis.net/ Change-Id: I84d818a7e0ced5ffb9485ec89a75efb28a77c1e0
* phpunit: Add some @covers and @large/@medium to integration testsTimo Tijhof2018-03-201-0/+1
| | | | | | | | - @small: single class, no I/O (unit test). - @medium: multi-class (partial or no mocks), no I/O (unit/integration test). - @large: multi-class, I/O allowed (integration test). Change-Id: I09317e6dd9b0ee34b7467fbffdd07957ef55dc04
* MWHttpRequest: Restore ability to pass null for $optionsKunal Mehta2018-02-061-1/+1
| | | | | | | | | | Prior to 3de744597e34, it was possible to pass `null` for $options. Restore that by setting the default type to be null, and explicitly document that null is a supported value in the doc block. Also update the signature of MWHttpRequestTester to match. Change-Id: I74d586afa5527e0a30ea99f3989f4dd12fa9fea1
* Add @coversNothing in places where @covers does not applyKunal Mehta2017-12-281-0/+1
| | | | | | | | | | | These tests apply to things that are not relevant to PHP code coverage, such as testing presence of messages, JSON files, or the PHPUnit tests themselves. Using @coversNothing indicates that there is no code here to be covered, and prevents warnings when using --strict-coverage mode (T152923). Change-Id: Id89ee2c15a3ce3f10e34b13fb677cd1af75af9e6
* tests: Use checkPHPExtension() instead of re-implementing itKunal Mehta2017-12-251-3/+1
| | | | Change-Id: I7f5e8684d556befc0aefa302187c573e7a3cff62
* Do not run tests that depend on curl if it is not loadedHuji Lee2017-09-191-0/+4
| | | | | Bug: T176193 Change-Id: Ia7b9b0196f800eb14463acc2a24df5ac1e48f3ed
* HttpFunctions: Increase code coverageTimo Tijhof2017-03-291-41/+51
| | | | | | | | | | | | | | | * Complete coverage for Http::getProxy(). * Remove bogus @covers tag on data provider, and add the relevant MWHttpRequest::getFinalUrl to the test instead. * Convert test to use dataProvider and add missing test cases to increase getFinalUrl() test coverage to 100%. * Minor clean up in getFinalUrl to consistently use early-return for all cases, not just for relative 'domain' and 'isset-host' cases. Without this coverage actually couldn't reach 100% due to the remainder of the empty else branch never being reached (CRAP: "Redundant 'else' after 'return'") Change-Id: I775d95965dc23a1e6c4c62ed84f9da64b6c72135
* Follow-up 1e9c3619: Correct @T1234 accidental cruftJames D. Forrester2017-02-241-1/+1
| | | | Change-Id: I94e50ef3356e4e53f9a9082484dff97e49a0e2e2
* tests: Replace implicit Bugzilla bug numbers with Phab onesJames D. Forrester2017-02-211-3/+3
| | | | | | | It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345" except where it doesn't, so let's just standardise on the real numbers. Change-Id: I46261416f7603558dceb76ebe695a5cac274e417
* Clean up http classes a bitGergő Tisza2016-11-301-0/+534
* added integration tests. We probably don't want automated tests to make external requests but these make manual testing more convenient. Documented some oddities discovered by testing. * made ::$status, ::proxySetup() and ::getHeaderList() protected; they were not referenced in any gerrit-hosted extension and they provide no useful functionality to external callers. Similarly, marked ::read() and ::errorHandler() as internal (these are used as callbacks so can't be protected) * removed inheritance abuse in ::execute() * documented ::execute() as returning a StatusValue (but keep returning a Status for now) * changed setCookie argument defaults to ones that make sense * replaced MWException * moved unit tests to the correct location * fixed some code style issues Change-Id: I5852fc75badc5d475ae30ec2c9376bde7024bd95