This includes fixing some mistakes, as well as removing
redundant text that doesn't add new information, either because
it literally repeats what the code already says, or is actually
duplicated.
Change-Id: I3a8dd8ce57192deda8916cc444c87d7ab1a36515
The main purpose of this class is to generate filenames during
tests. The reason it doesn't use fixed filenames is not because
it wants to be a fuzzy test, but because it wants to allow
running against a development wiki (outside CI) multiple
times where one test may've failed and unable to clean up after
itself, or where you may've done something manually and thus
a conflicting file exists in the local wiki from before
the DB was cloned for testing.
Using dictionary based random names is needlessly complex,
and has the additional downside of actually not avoiding
conflicts very well.
Replace all this by using a timestamp instead, which is much
more stable over time and basically will never conflict with
itself unless two tests were run on the same machine and started
in the same second (or if the clock went backwards/broken).
That seems unlikely enough to not need to support magically.
But to counter-act it a bit still, also add a 3-char random hex
in front of it. This also helps with file listings so that
when you run it three times, it's easier to see the files generated
by the same run close to each other (by not having subsequent
tests start with a mostly identical prefix).
Bug: T222416
Change-Id: Iec1d89324ff2fa53d1712796157adaf4ed34bdfe
RandomImageGenerator::getRandomLines() is trying to select a random
subset of lines from a dictionary file, but the algorithm has a few bugs
that cause it to potentially leave entries in the returned array as null
and to be biased against the first few lines in the file.
This patch corrects the bugs to implement a Fisher–Yates (or Knuth)
shuffle,[1] run in reverse so that N does not need to be known ahead of
time and only maintaining the desired subset of the array in memory.
In local testing over many trials, it has produced output without nulls
100% of the time and the aggregate results do not have any obvious bias.
[1]: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
Bug: T222416
Change-Id: If136928bda2165198d3957a3536de85d465321fc
Add public, protected or private to function missing a visibility
Enable the tests folder for the phpcs sniff
Change-Id: Ibefce76ea9984c47e08c94889ea2eafca7565e2c
The used phpcs has a bug, so the version 0.9.0 could not be enforced at the moment.
Will be fixed in next version, see T167168
Changed:
- Remove duplicate newline at end of file
- Add space between function and ( for closures
- and -> &&, or -> ||
Change-Id: I4172fb08861729bccd55aecbd07e029e2638d311
MediaWiki default is "@return type Description", so set a type after
return and start the description with a capital letter. Also use the
more common spelling of boolean.
See http://phpdoc.org/docs/latest/references/phpdoc/tags/return.html for
more about @return
Change-Id: I4e5198822fe92836f9cef9918a9fc1a1a1e0a043
- Swap "$variable type" to "type $variable"
- Fixed spacing inside docs
- Makes beginning of @param/@var/@throws in capital
- Changed some types to match the more common spelling
Change-Id: Ia041964250d8b7c0349d79dc9b131c5b8696e795
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.
Change-Id: Ic8aaf0a93796b97d0fa4617c1f86ff59f4b36131
Also swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Change-Id: Ic36c8c7820a6c2d603f1138130670c6bf6a1ca59
We can now do this since we finally switched to PHP 5.3 for MW 1.20 and get rid of the silly dirname(__FILE__) stuff :)
Change-Id: Id9b2c9cd2e678197aa81c78adced5d1d31ff57b1
* Move Imagick check into getImageWriteMethod(), adjust exception catching. Previously this was bailing on the test if you have convert but not the PHP Imagick extension. Now all these tests are passing for me again.
* Rm unused member variable, whitespace, etc
* Block.php: Set mExpiry to the value we store in the database, so that Block::equals() returns true. Fixes BlockTest::testInitializerFunctionsReturnCorrectBlock.
* In Title::checkUserBlock(): Convert message parameters to plain strings to make strict comparisons work. Fixes TitlePermissionTest::testUserBlock().
* ApiBlock.php: Follow-Up r85166, add 'Confirm' parameter to data array. Fixes ApiBlockTest::testMakeNormalBlock().
* ApiQueryTest.php: Use $wgMetaNamespace instead of $wgSitename to account for customizations.
* RandomImageGenerator.php: Use default value for constructor param to prevent fatals.
* ApiTestCaseUpload.php:
** Fix undefined variable $fileName.
** Remove stray ini_set statements, they don't belong there. Especially ini_set( 'error_reporting', 1 ) will effectively disable all reporting, which makes errors hard to track.
* ArticleTablesTest.php: Put testbug14404() in group Broken, as the fix for the bug has been reverted in r83868.