Commit graph

22 commits

Author SHA1 Message Date
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