Improve test coverage for ApiBase.php
authorAryeh Gregor <ayg@aryeh.name>
Tue, 20 Mar 2018 17:34:03 +0000 (19:34 +0200)
committerAryeh Gregor <ayg@aryeh.name>
Sun, 8 Apr 2018 12:51:42 +0000 (15:51 +0300)
commitd3da5e08d35f67c967bd2a29ad2983685b66f0d3
tree9a4b7b309ae2bcd2b0158f8cee575637064407c7
parente4277f170be4cb8aee0fe407793db47a94ec24c2
Improve test coverage for ApiBase.php

One bug fixed: a timestamp of '00' or similar would get interpreted as
'now' by mistake instead of Unix timestamp 0, without throwing the
warning for using 0 instead of 'now'.  This is because it called
wfTimestamp() once to parse the input date, got a Unix timestamp of 0
back, and then tried passing that 0 back to wfTimestamp again to
reformat as a wiki date, but it got reinterpreted as 'now'.

Also fixed parameters with type "user" to validate usernames more
correctly.  This might be risky, though, if I missed any valid
usernames, or if API clients were for some reason relying on passing in
invalid usernames.  If we don't actually want to do this, we should add
a comment explaining why we're allowing any title without a fragment
rather than validating properly.

Still lots more work to do here.

Change-Id: I56b4290263df8698efdbddda71a7eabd9e303abc
includes/WebRequest.php
includes/api/ApiBase.php
includes/api/ApiMain.php
includes/api/i18n/en.json
includes/api/i18n/qqq.json
tests/phpunit/includes/api/ApiBaseTest.php