Commit graph

26 commits

Author SHA1 Message Date
thiemowmde 02106770a7 Add test cases for {{#if:… and such with no possible output
These are edge-cases we should make sure are covered so we don't
accidentally change how they behave.

Change-Id: Iddd08a7e752ad1fe813ed42b665e4f656c9f516c
2022-12-16 21:50:16 +01:00
thiemowmde 928a21605a Remove dead code from #titleparts implementation
It's impossible that explode() returns an empty array. This is dead
code.

Also add tests for the previously untested #titleparts function to
make sure this patch doesn't change any behavior. Including weird
usages with negative numbers.

Change-Id: Ib0d2503fdb0900bf6db3ebbc26d2ff648dbfc86d
2022-11-03 18:30:49 +01:00
Reedy f647423039 Correct namespacing to match best practices
Bug: T303105
Change-Id: Ic09ed23c4248e74f93e5807212fe73d241251281
2022-03-05 15:06:59 +00:00
C. Scott Ananian 16c50e014e Update parserTests to v2 (tidy by default)
Bug: T249138
Change-Id: I663c3919e08688354d68ced6945f6eb40265d2ac
2020-04-01 16:03:19 -04:00
James D. Forrester 57d561a797 phpcs: Enable MediaWiki.Commenting.PhpunitAnnotations.ForbiddenExpectedException and make pass
Change-Id: I5a0fc6dc753e3d3a0192647304d4b02e467f23a5
2019-10-12 03:10:31 +00:00
Max Semenik 1e8444fad1 Improve ExprParser test coverage
Had to change a bit how ExprError is used, to prevent having to turn unit
tests into ingergation tests, adding 5 seconds to run time.

Change-Id: Id4e158f3a4418d320b1c0bdac834ebbba03762af
2019-09-05 15:37:21 -07:00
Max Semenik 890874c771 Mark ExpressionTest as unit
Change-Id: I0321a100ff60b3adf7e0aec400287a5be7384541
2019-07-22 00:42:21 -07:00
Max Semenik f53debae7d Namespace this extension
Change-Id: I0c7719f17f74180a4c85f914888262f7e3b13111
2019-04-03 19:20:14 -07:00
Max Semenik 593529bc72 Simplify test code
No point in having a property and setUp() just to create a
parameterless class.

Change-Id: I5e7838004d306aac767380280280eed3108e2253
2019-03-27 20:53:55 -07:00
jenkins-bot c692534ef4 Merge "Update tests to match parser changes" 2019-03-19 14:37:13 +00:00
jenkins-bot f1604084fa Merge "Update tests to match parser changes" 2019-03-19 14:18:28 +00:00
Arlo Breault 5c6ef32a11 Update tests to match parser changes
Bug: T208070
Depends-On: I3da235cb83efa424f0cf1cf4fc7233240fcdf6b2
Change-Id: I47d1d9620031036b9497cacf70b34a45c3e5f409
2019-03-19 14:07:19 +00:00
Kunal Mehta ab601a2ca7 Upgrade to newer phan
Bug: T216933
Change-Id: If8a63da99343597b7f8c131f3656945eaf67d819
2019-03-16 22:39:09 -07:00
Arlo Breault ae237035f1 Update tests to match parser changes
Bug: T208070
Depends-On: I3da235cb83efa424f0cf1cf4fc7233240fcdf6b2
Change-Id: I74953d5de765a2245a2999f17c7ae1cf49376bd1
2019-03-15 18:24:34 +00:00
Alexia E. Smith cf1480cb96 Fix E_WARNING with {{#pos:}} if the offset is larger than the string
The mb_strpos() function throws E_WARNING if the offset is longer
than the length of the string.

Bug: T209600
Change-Id: Ib4296ba136eaf5c8461681e9d5f108118b2494f4
2018-11-15 12:50:32 -08:00
Umherirrender 99659b32c2 Add method scope visibility
Change-Id: I116b91653c01ace9fa0d9a49f2fa43375ef2924d
2018-11-01 19:50:46 +01:00
Jayprakash12345 e6385dfb32 Update extensions to take advantage of parser test autodiscovery
Bug: T170037
Change-Id: I41d7ee671ca103097271379df83cf63d979ee709
2018-04-13 14:58:29 +00:00
Kunal Mehta 23e9751985 build: Updating mediawiki/mediawiki-phan-config to 0.2.0
Change-Id: Ib60f7228deb749ac817fab0f28e2f8c937541cf3
2018-04-05 17:16:51 -07:00
Kunal Mehta 2abee407f2 Add phan configuration
Change-Id: I1127f08213d5ce3f33381506027dc8129cf6aa6c
2018-02-24 14:09:51 -08:00
Kunal Mehta be4f4b1858 Add @covers tag
Change-Id: Ib12892b36b2d1254cfcc861a3a84d859d5834a3f
2018-02-16 20:57:24 -08:00
Kunal Mehta 908f029b80 build: Updating mediawiki/mediawiki-codesniffer to 0.9.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingParamName
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.FunctionComment.Missing.Public
* MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment

Change-Id: Iaa65f1987144baffd480d082538547fc9cf2c15b
2017-06-25 13:48:36 +00:00
Umherirrender 04e4c1b300 Add phpcs and make pass
Change-Id: I8f985ca83223f1a2fdb4365294701f3b1d9b019b
2017-06-06 19:51:28 +00:00
Reedy adf6a2edc8 Remove 'UnitTestList' hook
No longer needed now that extension unittests are autodiscovered.

Bug: T142120
Bug: T142121
Change-Id: I075b7f6b5e11ead988b0baba5d85745dbb9ac480
2016-08-05 21:24:45 +01:00
Brad Jorsch 0fb7807e9a (bug 43451) Restore old behavior of 'mod', add 'fmod'
In trying to fix bug 35866, I32c9eca6 changed the behavior of 'mod' to
no longer cast its arguments to integers, which conventiently also
solved bug 6068. However, this also broke many existing uses that
depended on that casting.

This change reverts 'mod' to its old behavior while still solving bug
35866, and at the same time adds a new 'fmod' operator with the new
behavior to keep bug 6068 fixed as well.

Change-Id: I6114c6e769119e6ced61b3b55b6f70b03b5b1ebe
2012-12-28 16:27:23 -05:00
Reedy 1a96b47d94 (Bug 35866) ParserFunctions: Division by zero in Expr.php
The PHP modulo operator ('%') casts its operands to ints, causing
floating point values 0 < $right < 1 to raise a divide-by-zero error.
Explicitly casting both operands to float and using fnmod() resolves the
issue. This change also tidies up the check for zero values and adds
tests.

Change-Id: I32c9eca6552e4fec248eb4fa6419faa39c10df3b
2012-12-11 03:21:58 -08:00
Reedy 57a6ec2942 Bug 42809 - Replace testExpr with a PHPUnit test
Change-Id: I338af01b50684b5849ca198eac536eacdc916ec6
2012-12-07 18:34:58 +01:00