Commit graph

37 commits

Author SHA1 Message Date
Siebrand Mazeland
e1d58d9071 Pass phpcs-strict on some test files (8/11)
Change-Id: I138c1f9bf2c3c7e9218d5fa29365e78b309fb459
2014-04-24 13:49:48 -07:00
Siebrand Mazeland
80a8a8e85c Pass phpcs-strict on some test files (5/x)
Change-Id: I690645cd8a9b1165dcc8271b201c695ea9391226
2014-04-24 18:51:45 +02:00
addshore
f86db05d8d Remove unused stuff from tests
Change-Id: Iddabfbc80378b02fa4a2c58f80d50241be8105d3
2014-03-07 21:16:32 +00: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
addshore
4e941cf4ca Add @covers tags for more tests
Change-Id: Iff3af78e9b41c445b7f066b6c0d0f4a87d2d6c4e
2013-10-21 11:28:39 +02:00
Daniel Friesen
97caae596d Drop support for XHTML 1.0
* $wgHtml5 = false; is now ignored completely.
* $wgDocType and $wgDTD have been removed.
* $wgXhtmlDefaultNamespace is now ignored.
* XHTML5 will be output if $wgMimeType is set to an XML mime type (according to HTML5's rules).
* For backwards compatibility with extensions $wgHtml5 and $wgXhtmlDefaultNamespace are set
  in Setup.php but depending on them is deprecated.

Change-Id: Iad9634e2ee420b5a3bbffe550421fde4fa1819b0
2013-05-15 23:09:25 -07:00
Siebrand Mazeland
419b02b6df Update formatting
3 of n.

Change-Id: I62ad009018c54da6cf081c334e44eb98a3c72695
2013-02-14 12:56:23 +01:00
umherirrender
ee643dd587 Set wgHtml5/wgWellFormedXml for XmlTests
Change-Id: I3cab843bad9461098cf3c6b574fb767c3267ab14
2012-12-09 11:47:03 +01: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
Timo Tijhof
d1c8bf85f8 Fix HtmlTest, XmlTest; Add setMwGlobals method to base TestCase.
The HTML and XML test now set the globals they depend on
(instead of relying on the default settings).

Tests for the "other" scenarios still exist, globals are
overridden inline. They are automatically restored after each
test## function by PHPUnit from MediaWikiTestCase::tearDown.

Also fixed 2 other problems with the test suite:

* HtmlTest::testDropDefaults forgot to pass
  $message to the assertion from the provider ($case[3]).

* The data provider for HtmlTest::testDropDefaults was calling
  Html::element directly (instead of calling it within the test)
  which is problematic because data providers are expected to be
  static. PHPUnit calls them outside the setUp/tearDown flow.
  (also fixed the function to be public static, as PHPUnit
  expects).

That last one was crucial to make the test still pass correctly.

Updated the expected strings to what they are with these
fixed non-leakage settings.

Took wgHtml5 without xmlform as default. And added tests
for variations where it made sense.

Change-Id: Iccf6ea81f4bc2639273ab2ad101c58788ee49d45
2012-10-09 00:26:52 +02:00
Alexandre Emsenhuber
3beaa0a027 Follow-up Ifd700826 (60d119c), address a fixme in a re-enabled test.
Make the "Date menu next month is 11 months ago" also work when the
current month is december.

Change-Id: Ie7b998bf962abbb3e2f789a3d8a9af8c52e7feaa
2012-09-23 10:15:20 +02:00
Tim Landscheidt
60d119c6e2 Fix broken tests for Xml.
Change-Id: Ifd7008269cc960004676ba79449911d63476615c
2012-09-22 02:17:33 +00:00
robin
72ebf55665 Use Xml::languageSelector in SpecialAllmessages
Improve Xml::languageSelector: add parameters to change label message and id/name of the select tag.

Use languageSelector in SpecialAllmessages (less code duplication)

Patchset 10 July: add tests per MaxSem; add version for new parameters and change the message parameter to require a Message object per Nikerabbit

Change-Id: I7fbb29ee2dc37a2b6a5e2cfc88207a0b47b83e9b
2012-07-10 13:43:38 -04:00
Alexandre Emsenhuber
a606e89c6b Removed XmlTest::testNamespaceSelector(); it just breaks when $wgDevelopmentWarnings is set to true due to the fact that Xml::namespaceSelector() calls wfDeprecated(). 2012-03-19 12:44:36 +00:00
Aaron Schulz
1bebf0c7ea Fixed windows-related test failures (that string format doesn't work with \r\n line endings as the \r chars are left in the PHP string). 2012-02-02 18:42:02 +00:00
Krinkle
6ebbb369a6 [Xml::encodeJsVar] Change to match FormatJson::encode output
- Pure whitespace change
- In preparation to deprecate it in favor of FormatJson / json_encode
2012-01-30 19:40:20 +00:00
Chad Horohoe
e8da212569 Fixup r109698, add setter for $namespaceNames and use proper accessors in the tests.
Since we're here: nothing uses $namespaceNames, $mNamespaceIds or $namespaceAliases
outside of this class (core or extensions) so lets make it protected.
2012-01-27 13:00:26 +00:00
Krinkle
3c9d05055b [Html] Unit test + bugfix Html::namespaceSelector
* Previously it was passing $selectAttribs['name'] to Xml::label, which uses its value for the <label for=""> attribute. This works as long as $selectAttribs['id'] and $selectAttribs['name'] match, but when they don't it fails. <label for=""> always corresponds with <{input,text area,select} id=""> in browsers, never with "name".
* Make name/id match eachother by default to avoid backwards compatibility breakages (they used to match in the Xml class method as well)
* Add HtmlTest.php entries similar to the ones in XmlTest
* Fix E_NOTICE about $params['selected'], default to ''

-- Follows-up r109974, r109698, r109990
-- Bug originally introduced in r41425
-- XmlTest.php still runs successfully
-- HtmlTest.php runs successfully
2012-01-25 03:25:54 +00:00
Krinkle
957c3b5b68 [Unit testing] Re-order attribs to a-z to make testing more reliable
* This is in preparation for deprecating this in favor of an Html:: method soon, making sure here that tests still match afterwards
* Follows-up r109698
2012-01-25 00:52:29 +00:00
Krinkle
4790826b97 [Unit testing] Add unit tests for Xml::namespaceSelector
* Making Language::namespaceNames explicitly public. It already was but since is being used as such outside the class
2012-01-21 22:26:14 +00:00
Alexandre Emsenhuber
de67af20d0 $wgLanguageCode goes with $wgContLang, not $wgLang. This was breaking ApiBlockTest because $wgContLang->getCode() != $wgLanguageCode. 2012-01-19 10:05:38 +00:00
Chad Horohoe
35a5be8617 @group Broken rather than marking incomplete 2012-01-08 16:38:59 +00:00
Sam Reed
73f3004002 Don't comment tests out, use $this->markTestIncomplete()
Followup r104812
2011-12-01 14:40:11 +00:00
Sam Reed
6c289b9fba Comment out brokwn Xml::dateMenu() tests
Failing because it's december (ie the test is wrong)
2011-12-01 00:40:56 +00:00
Niklas Laxström
48714a4968 Followup r99305 - change tests to match behaviour. Would set globals but restoring them manually is just too laborious 2011-10-08 11:58:01 +00:00
Aaron Schulz
31a7892e83 Fixed failing XML tests (on windows) due to newline vs carriage return discrepancy...ugh 2011-07-12 20:05:02 +00:00
Antoine Musso
940f3d5f93 update tests for Xml::label which now support 'title' attribute
follow up r90669
2011-06-23 20:05:32 +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
Platonides
809102860a Follow up r87210 2011-05-03 22:37:14 +00:00
Platonides
10cd6f1b6a Fix the old XmlTest.php test bug in the dateMenu() when the wiki is configured for a languange other than English
Other tests were running before and messing with the Language objects.
2011-05-01 19:32:49 +00:00
Brion Vibber
638b6751e1 * (bug 25571) Xml::encodeJsVar now passes floats natively instead of converting to strings
Added unit test cases for int, float, and strings that look like int or float.
2011-02-14 00:54:40 +00:00
Antoine Musso
28bab8ff2e Complete coverage of Xml::DateMenu()
r81605 was not hitting all possible conditional tests. Verified with:

php phpunit.php --configuration suite.xml \
  --coverage-html /tmp/datecover \
   --filter DateMenu

Tests:
PHPUnit 3.5.10 by Sebastian Bergmann.
.
Time: 3 seconds, Memory: 27.50Mb
OK (1 test, 5 assertions)
2011-02-06 22:10:48 +00:00
Antoine Musso
979ebc5189 Tests for Xml::DateMenu() 2011-02-06 21:23:12 +00:00
Antoine Musso
ddd8f91a5b Tests for XmlSelect::addOption()
PHPUnit seems to only accept one class per test file. This patch move the
XmlSelect class to a new file.

It also add some assertions for XmlSelect::addOption(). Please review them
carefully! Although the assertions are fine:
  OK (5 tests, 5 assertions)

I am not sure they are the expected behaviour.
2011-02-05 23:41:29 +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