Commit graph

21 commits

Author SHA1 Message Date
Max Semenik eb8ccf03db Get rid of call_user_func_array()
Yay PHP7!

Change-Id: I777ed78d22efbddacaab22c4614a0defa6ad3f94
2018-07-03 19:40:19 -07:00
Kunal Mehta d91a8cf8a0 Add @covers tags to all tests
Bug: T195160
Change-Id: I77ce544e9c166fef6c6fb02f67d1de6ddf0c2465
2018-05-29 11:37:27 -07:00
Kunal Mehta f76ba3c465 Disable Squiz.Classes.ValidClassName.NotCamelCaps globally
Instead of per-file. This happens to also fix a false positive with the
PhpunitAnnotations sniff.

Change-Id: I22621c37217ed2db9d8b3591df1a1421c25fa7f6
2018-05-24 22:26:11 -07:00
Brad Jorsch 32718af677 ustring: Handle invalid types in gsub
If the replacement table or function results in a value that isn't a
string or number (or nil), string.gsub raises an error. Have ustring
raise the same error.

Bug: T195326
Change-Id: Ic36f9f5d7adc0c14e7a4a94d3747335107acd8b6
2018-05-22 18:55:49 -04:00
Jayprakash12345 7da38c8e10 Update extensions to take advantage of parser test autodiscovery
Bug: T170037
Change-Id: Ifeffbf7a27dfd4915998159617d37d4d9b9a1c17
2018-04-13 15:07:17 +00:00
Umherirrender 44fe3df9bf Rename test classes to end with Test
Change-Id: I510e5516d56b28d26510423da840b4b496a10833
2018-03-10 14:25:38 +01:00
Kunal Mehta 27a7eb0f58 Use namespaced PHPUnit\Framework\TestCase
For future compatibility with PHPUnit 6.

Bug: T188166
Change-Id: Id1e951d7e9a2092500408ab865427db45c025bde
2018-02-24 00:23:15 -08:00
libraryupgrader 6d1a6ffb01 build: Updating mediawiki/mediawiki-codesniffer to 16.0.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.MissingCovers.MissingCovers

Change-Id: I07b2cf945f44fd5532812a712f7dd40d2f208be2
2018-02-15 13:57:18 +00:00
Brad Jorsch 790311faa3 Sanify handling of array keys
When passing an array from PHP to Lua, stringify integer array keys
beyond the range a lua_Number can represent.

When passing a table from Lua to PHP,
* Avoid exponential encoding for integer keys beyond 1e14, so Zend PHP
  will interpret them as integers.
* Always encode integer keys as integers, so HHVM will interpret them as
  integers.
* Detect collisions, e.g. { [0] = 'foo', ["0"] = 'bar' }

Bug: T186240
Change-Id: I078068ed57df078248a307608381614bdfc70801
2018-02-06 17:13:20 -05:00
Kunal Mehta ec7b1b05cf Fix Scribunto_LuaStandaloneInterpreterTest::testGetStatus on 7.1+
The extraneous whitespace in the return value from wfShellExec() causes
multiplying $size to trigger the newly introduced "A non well formed
numeric value encountered" warning in PHP 7.1+.

Work around that by using trim() to get rid of the whitespace.

Bug: T186299
Change-Id: I3d47ef6cc7fb99b4d4840dc847d150c3939ee535
2018-02-01 21:08:32 -08:00
jenkins-bot 252d117fdd Merge "Improve some parameter docs" 2018-01-16 16:21:51 +00:00
Umherirrender cfbd0a1a1b Improve some parameter docs
Change-Id: Ic85f74fc8dcefe86a3620e2d12f0b2ad2386ee23
2018-01-11 21:27:53 +01:00
Kunal Mehta 76dbe5d804 Treat phpdbg as being run from the command-line
The two lualib/ustring generation scripts run independently of MediaWiki, so
the new wfIsCLI() isn't usable there.

Bug: T184043
Change-Id: I217657d12e16a7b76dc814be5fed03540c461e7c
2018-01-10 19:47:19 +05:30
Marius Hoch 12acfa95ef Make Scribunto_LuaSandboxTests::testArgumentParsingTime more robust
This should make sure the tests still work, even if the running
node is heavily overloaded.

Bug: T143389
Change-Id: Ic40c8d76c8799c2e9d11f53945276747c199fd02
2017-10-10 10:38:23 +02:00
Brad Jorsch 9fefb11d56 Replace uses of each()
It's deprecated in PHP 7.2, may as well replace it now.

Bug: T174354
Change-Id: I2c37229d69a9646edaa61e25e28b13e8190a8359
2017-09-19 16:46:51 -04:00
Brad Jorsch 7418a571ac Fix tests
Iaa880531 added extra frames in the call stack, so the frame being
tested by the "setfenv invalid level" and "getfenv invalid level" tests
was no longer invalid.

Bug: T175065
Change-Id: Id1028e7c8bbb92fb9d7d01ebeabd94e8ba284b1c
2017-09-05 15:44:55 -04:00
Brad Jorsch ca85f20099 Make mw.uri.encode 'WIKI' mode match core {{urlencode:}}
The core {{urlencode:}} parser function doesn't encode various
characters in WIKI mode that it does in other modes. mw.uri.encode
should match that.

Bug: T174239
Change-Id: I2be0811cf39c02c5c0ad3433e4b0ef9030350e24
2017-08-28 10:34:16 -04:00
Kunal Mehta b8ff734aa4 Use namespaced ScopedCallback
The non-namespaced version is deprecated since 1.28

Change-Id: Icb3fed78882913a26aad4bdb1a84cb5a3e8ca6bb
2017-08-21 14:06:34 -07:00
WMDE-Fisch e1763ff69a Updating mediawiki-codesniffer to 0.10.1 and fix issues
Change-Id: Iac61e49ab0f1318fcb7b23b4c90b6a427fe8957f
2017-07-25 17:16:47 +00:00
Umherirrender 18b22b3a3d build: Updating mediawiki/mediawiki-codesniffer to 0.10.0
Change-Id: I92b9fb936cb8fa8411850b97804e2aacf3984322
2017-07-08 15:42:23 +02:00
Kunal Mehta 31820c673a Move tests into tests/phpunit and remove UnitTestsList hook
This takes advantage of extension.json's unit tests autodiscovery
mechanism.

Bug: T142120
Change-Id: Id526f3368fc73ba7e6ef1d793ea70ab05fbd9517
2017-07-07 13:50:39 -07:00