* mw.config is the new way, and global config variable lookups are deprecated
* Based on two phase3-wide quick searches:
-- of " wg": http://toolserver.org/~krinkle/wikimedia-svn-search/view.php?id=321&hash=81700bf7486e4fee3b7bc1f83eb9eba6
-- of "!wg": http://toolserver.org/~krinkle/wikimedia-svn-search/view.php?id=327&hash=47c9d54a7a1d5d58a724dd834585f40d
Related changes:
* Changed some php comments mentioning "wg" variables to include the dollar sign, and a typo when the wf function prefix was meant.
* Removed TODO comment in wikibits.js and made it use the JS equivalent of wfUrlencode, which we have now, mw.util.wikiUrlencode
* SpecialUpload.php: use OutputPage::addJsConfigVars instead of creating a new script tag through OutputPage::addScript(Skin::makeVariablesScript(..))
* Renamed wgUploadSetup in upload.js and made it local. Not used anywhere in ./trunk/phase3 and ./trunk/extensions
* Fix OutputPage::addJsConfigVars so that it can actually be called with an array instead of two arguments for key/value
* Some minor whitespace/convention stuff around the same line
* Added some new methos such as Watchable/Subpages/Capitalized/Content
* Fixed namespace 0 being converted to NS_ , now show NS_MAIN
* Converted all assertion calls to use the __call() hack
Follow up r105883
* MWNamespace::equals to test equivalence of two namespaces (forward compatible with any changes we may make like introducing namespace keys like 'USER')
* MWNamespace::subjectEquals to test equivalence of the subject of two namespaces e.g.: MWNamespace::subjectEquals( NS_USER, $ns ); instead of testing for equivalence to both NS_USER and NS_USER_TALK
* Title::inNamespace to use instead of $title->getNamespace() == NS_???
* Title::inNamespaces for use like $title->inNamespaces( NS_USER, NS_PROJECT ) when you only care if it's in one of a number of namespaces (also accepts an array)
* Title::hasSubjectNamespace for use instead of testing for equivalence to both the subject and talk such as NS_USER and NS_USER_TALK.
Include phpunit tests for all this new code, and also add some tests for some existing code.
Per CR on r92234, this correctly test hasSubpages independently from your
local configuration. Also test altering the global and having static
methods reacting accordingly.
It was actually testing for associated. Thanks copy & paste for this bug.
Test result:
$ php phpunit.php -c suite.xml includes/MWNamespaceTest.php
.........IIIII..........
Tests: 24, Assertions: 99, Incomplete: 5.
MWNamespace::getTalk() could give erroneus results when using it on specials
namespaces (NS_MEDIA, NS_SPECIAL). It now use MWNamespace::isMethodValidFor()
which will throw an exception if a special namespace was given.
MWNamespace::getSubject() is now returning identity for specials namespaces.
New MWNamespace::getAssociated() used to find out the subject page of a talk
page and vice versa. Special namespaces will results in an exception.
TESTS:
Added tests for almost complete code coverage. Functions relying on global
$wgCanonicalNamespaces are still incomplete though.
MWNamespace::isMovable() needs more assertions.
Tests results (ignoring incomplete tests output):
$ php phpunit.php --filter MWNamespace
PHPUnit 3.5.10 by Sebastian Bergmann.
.........IIIII..........
Time: 1 second, Memory: 31.75Mb
OK, but incomplete or skipped tests!
Tests: 24, Assertions: 99, Incomplete: 5.