Commit graph

31 commits

Author SHA1 Message Date
Chad Horohoe
c33f4de066 Profile all external HTTP requests from MW
Change-Id: Ie980b080da2ef21ec7d9fc32f1accc55710de140
2015-03-03 20:54:30 -08:00
Chad Horohoe
7ee5b7d23b Allow profiling of Http requests
Http::get/set/request() now all take a new $caller parameter
which is like $fname in databases. Pass it __METHOD__ so all
of your external requests can be grouped together in profiling.

Change-Id: Ibad219452903a9678378044595cff1231bf605d8
2015-03-03 20:54:24 -08:00
dan-nl
1f607e1e17 HttpTest: Update cURL constants array
The mediawiki-core-regression-hhvm-master test for I21747063 found
failures for some constants provided by the provideCurlConstants()
array.

https://integration.wikimedia.org/ci/job/mediawiki-core-regression-hhvm-master/2072/console

I have commented out the failures that occur in the current mw
HHVM 3.3.0 environment in order for the test to pass. none of the
commented out constants appear in the mw core code.

PHP 5.6.0 removed several cURL constants http://php.net/manual/en/curl.constants.php.
I have commented out those constants and verified that they do not
exist in the mw core code.

Bug: 71729
Change-Id: I30c5e78eacf19071aaf44834ca188172f082e161
2014-10-07 22:21:16 +00:00
dan-nl
687920abf5 Add cURL constants test
Bug: 70570
Change-Id: I217470638adc1973ebe1227cc9fb65e1c3fab1b7
2014-09-16 13:43:30 +02:00
Siebrand Mazeland
ce42915e0d Pass phpcs-strict on some test files (2/x)
Change-Id: Ia39fd107a554206927652b6e168faa0da501b362
2014-04-24 17:05:34 +02:00
addshore
de7af7ac2c Fix scope on all /phpunit test methods
Change-Id: I3ce92463d485a0fb23e464e9a8059330f32d79af
2013-10-24 10:31:32 +02:00
addshore
fb16eb2abe Add more @covers tags and test cleanup
Other cleanup includes
 - Adding method scopes
 - Fixing php comments
 - Adding todos

Change-Id: I0a231008e6a59110ffcab6af1bd8c4d3ee13f21d
2013-10-22 08:59:42 +00:00
umherirrender
24bfde2710 Fix spacing and break some lines
Change-Id: Ia57685d8858e02e399ad5c75ce64d12609d340ac
2013-08-24 17:06:25 +02:00
Siebrand Mazeland
791d0b2a98 Update code formatting
Change-Id: I16a9b42651f1cfb1a70dffbb67b7b83dfeb90d03
2013-04-26 14:21:20 +00:00
Siebrand Mazeland
ac63001d8e Update formatting
1 of n.

Change-Id: I852729f08bbb0c5e39c2db44362ccdc7f59dcc08
2013-02-14 12:22:13 +01:00
Antoine Musso
0fd05285d7 pass codesniffer on tests/
Fix almost all occurences of the following sniffs:

Generic.CodeAnalysis.UselessOverridingMethod.Found
Generic.Formatting.NoSpaceAfterCast.SpaceFound
Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma
Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine
Generic.PHP.LowerCaseConstant.Found
PSR2.Classes.PropertyDeclaration.ScopeMissing
PSR2.Files.EndFileNewline.TooMany
PSR2.Methods.MethodDeclaration.StaticBeforeVisibility

Change-Id: I96aacef5bafe5a2bca659744fba1380999cfc37d
2013-01-28 12:14:26 +01:00
aude
f8b054388c fix fatal error in HttpTest
Change-Id: I29d31974bd467a501109e7817152ac4aa2c8c75b
2012-10-11 08:04:49 +00:00
Timo Tijhof
181c7cdc8e Clean and repair many phpunit tests (+ fix implied configuration)
This commit depends on the introduction of
MediaWikiTestCase::setMwGlobals in change Iccf6ea81f4.

Various tests already set their globals, but forgot to restore
them afterwards, or forgot to call the parent setUp, tearDown...

Either way they won't have to anymore with setMwGlobals.

Consistent use of function characteristics:
* protected function setUp
* protected function tearDown
* public static function (provide..)

(Matching the function signature with PHPUnit/Framework/TestCase.php)

Replaces:
 * public function (setUp|tearDown)\(
 * protected function $1(

 * \tfunction (setUp|tearDown)\(
 * \tprotected function $1(

 * \tfunction (data|provide)\(
 * \tpublic static function $1\(

Also renamed a few "data#", "provider#" and "provides#" functions
to "provide#" for consistency. This also removes confusion where
the /media tests had a few private methods called dataFile(),
which were sometimes expected to be data providers.

Fixes:

TimestampTest often failed due to a previous test setting a
different language (it tests "1 hour ago" so need to make sure
it is set to English).

MWNamespaceTest became a lot cleaner now that it executes with
a known context. Though the now-redundant code that was removed
didn't work anyway because wgContentNamespaces isn't keyed by
namespace id, it had them was values...

FileBackendTest:
* Fixed: "PHP Fatal: Using $this when not in object context"

HttpTest
* Added comment about:
  "PHP Fatal: Call to protected MWHttpRequest::__construct()"
  (too much unrelated code to fix in this commit)

ExternalStoreTest
* Add an assertTrue as well, without it the test is useless
  because regardless of whether wgExternalStores is true or false
  it only uses it if it is an array.

Change-Id: I9d2b148e57bada64afeb7d5a99bec0e58f8e1561
2012-10-09 03:01:51 +02:00
Brion Vibber
2fc16ba670 Add comments explaining that the funky multiple Location headers stuff is a CURL artifact, and that the code will need updating if bug 29232 is done (high-level handling of http redirects)
Followup r94881, r106948.
2011-12-22 23:12:44 +00:00
Antoine Musso
7505ddbb6d tests for r94881 which interprets relative Location: headers 2011-12-21 15:31:30 +00:00
Sam Reed
4622da783c More documentation! 2011-10-26 04:15:09 +00:00
Chad Horohoe
10a0d9d781 Gut anything from HttpTest that involves making external requests and setting cookies - the way we do this suite needs to be completely rethought.
Chalk this up as an example of how *not* to write unit tests.
Still have 5 failures :(
2011-09-08 14:04:36 +00:00
Roan Kattouw
ee44691063 Add tests for r96562. HttpTest still has 5 failing test (which is why it's marked @broken) and per Chad on IRC most of this suite is pure evil 2011-09-08 13:49:48 +00:00
Chad Horohoe
c22e9c06aa *grumble grumble* stupid fime on r90192 2011-06-21 21:38:29 +00:00
Chad Horohoe
860cdbc0ff Followup to r89452, remove ftp test cases since Http::isValidUri() doesn't do ftp anymore 2011-06-16 02:58:00 +00:00
Brion Vibber
174b7d6a7a Add more super-cookie test cases to HttpTest; things like org & .org aren't being handled correctly either. Not super high prio but... should probably mark these tests broken if can't be fixed easily yet. 2011-06-01 22:27:24 +00:00
Brion Vibber
31f414f75f Refactor validateCookieDomain test cases to use a data provider and report which bit's being tested so we can identify failures (there is still one failure in this set) 2011-06-01 22:13:47 +00:00
Brion Vibber
538578bdde Tweak HttpTest following r89278:
* remove FTP test case URL (shouldn't actually work, and as a directory listing, not super stable)
* remove old test case URLs that are now 30x redirects (example.com and a toolserver link), which broke the comparison tests
* added in http://en.wikipedia.org/robots.txt so we've got a nice basic fetch on one of our servers too

Now this test class is down to 3 failures, in URL & domain validation stuff
2011-06-01 21:25:45 +00:00
Brion Vibber
218b50d703 HttpTest regression fix: test URL on example.com no longer returns a 404 (now a 302 redirect), so switching the 404 tests to use an URL on mediawiki.org in the /xml/ dir where we stash actual files. 2011-06-01 21:13:13 +00:00
Mark A. Hershberger
623083aa78 Fix Bug #29231: PhpHttpRequest doesn't support HTTPS
Tested fix with PHPUnit Tests that aren't currently executed by
CruiseControl b/c they're marked “broken” till someone comes up with
some reasonable unit tests that will work for everyone.
2011-06-01 18:57:33 +00:00
Sam Reed
7f1c9f7b63 Fixup some more old version comparison stuff 2011-03-15 12:06:40 +00:00
Antoine Musso
e29fa6eef9 switch 'column' for 'colon'
I always thought the colon and semicolon punctuation marks were named after
their architectural equivalent: column. At least, to me, it made more sens
than using a term relating to thedigestive system.

Per Nikerabbit r83296
2011-03-08 07:27:18 +00:00
Antoine Musso
9ad5b773f7 Tests for bug 27854 - Http::isValidURI is to lax
Those tests are made to help someone fix bug 27854. You might want to add
some more.  Please note we want this function to only validate curl supported
URI, hence the hardcoded protocols http,https and ftp.

Some of those tests currently fail because of bug 27854.
2011-03-05 16:15:39 +00:00
Chad Horohoe
447529064b * verbose and color default output from phpunit
* Make a bunch of tests subclass MediaWikiTestCase
* Parser tests and ResourceLoaderTest can't subclass it yet due to various issues
2010-12-28 18:17:16 +00:00
Chad Horohoe
1ac02d7879 Missed another comment in r78381 2010-12-14 16:31:25 +00:00
Chad Horohoe
23f69f10ed Per wikitech-l discussion: Move tests from maintenance/tests/ to tests/. They're not strictly maintenance scripts, and some people want to do a selective checkout that doesn't include the tests. There's still debate on whether we should include these in the release downloads, but we had a pretty firm consensus to move this. 2010-12-14 16:26:35 +00:00