Commit graph

19 commits

Author SHA1 Message Date
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
Aaron
456177bdee [IP] Added an IP::prettifyIP() function for displaying IPs.
Change-Id: I53b3fe70bd0091ef02740f2b8950c36a0e4cf32e
2012-05-11 10:53:14 -07:00
Sam Reed
daa4e524b7 More occurrence typos 2012-03-19 21:40:39 +00:00
Sam Reed
6906724935 Add, update, tweak documentation
Fix document comment blocks

Tweak some returns
2011-10-26 03:45:13 +00:00
Sam Reed
90e74042b4 Fix comment blocks that start /* to /** 2011-10-11 18:30:50 +00:00
Aaron Schulz
c47386e27e Tweak r98602: keep the other IP normalization for non-ranges, such as upper case for v6. This keeps it a bit more consistent. 2011-10-01 05:11:21 +00:00
Aaron Schulz
9ac53dcc3b Made provideIPCIDRs() not add a '/' if there is no prefix length. Fixes bug 31234. 2011-10-01 04:54:44 +00:00
Antoine Musso
41741d4dec complement r96386 tests 2011-09-07 20:28:49 +00:00
Aaron Schulz
1ec49ff3d3 Fixed typo in ipv6 private IP range list and added test (bug 30739) 2011-09-06 23:15:42 +00:00
Tim Starling
6a2123260b * (bug 28798) Set $wgServer in the default LocalSettings.php
* (bug 14977) When detecting $wgServer, treat IPv6 addresses in $_SERVER['SERVER_NAME'] etc. in a sensible way. 
* Tests for the new functions in IP.php and Installer.php
2011-06-15 07:35:47 +00:00
Siebrand Mazeland
75c6696aa8 Use consistent notation for "@todo FIXME". Should update http://svn.wikimedia.org/doc/todo.html nicely. 2011-05-17 22:03:20 +00:00
Antoine Musso
16c6730b84 PHPUnit coverage comment must not have parentheses
Those comments have the format:
 @covers Class::Method

In PHPUnit 3.5.12, the comment is split by :: and method_exist called on
the resulting string. When one use  Class::Method(), the result is a call
to method_exist( 'Method()' ) which is always false and raise an exception

Removing parentheses from r79118 solve the issue. This also kind of
revert r79164.
2011-03-06 17:36:42 +00:00
Antoine Musso
6fbd3da876 tests for IP class, mostly incompletes
* IP::sanitizeIP()
* IP::canonicalize()
* IP::isInRange()
2011-03-05 17:30:33 +00:00
Aaron Schulz
f65ce02ff9 * (bug 27353) IPv6 address ending in "::WORD" was not recognized
* Moved down 'contains no "::"' alternative for clarity (and possibly use frequency too)
* Added more IPv6 tests
2011-02-13 23:24:48 +00:00
Antoine Musso
bd333e7fcf Reduce range of IPv6 tested by testValidIPs
By using steps of 0xF, the number of assertions is reduced from 70k
to 5k revisions. It is not that useful to test all of them.

Follow up r76569
2011-02-06 20:24:53 +00:00
X!
fa0ce7197a -Set configuration automatically if not set. This allows for evasion of the makefile, ergo, more control.
-Remove instances of @covers; they were breaking code-coverage
2010-12-29 05:38:11 +00:00
Chad Horohoe
a0636b3d44 Add @covers annotations to IP tests 2010-12-28 18:23:43 +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
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