The test ReleaseNotesTest:testReleaseNotesFilesExistAndAreNotMalformed
takes 4 seconds on my machine. That is due to assertLessThanOrEqual
being invoked for each lines of various files at the root of the
repository. HISTORY has more than 20000 lines and assert functions are
rather slow.
Refactor the test:
* extract the logic to verify the file length of various files to a
standalone test and with a dataprovider.
* flip the boolean logic ensuring whether the file exists. When it does
not, PHP emit a warning which breaks the test anyway.
* Check the line lenght and collect errors in an array, then for each
file run a single assertion to ensure the array of errors is empty.
That effectively get rid of assertLessThanOrEqual overhead.
* Use assertSame() to show the full faulty line. assertEqual() shorten
the arrays content.
Running tests went from 4 seconds to 700 ms on my machine.
Bug: T227067
Change-Id: I9bbbc6647ba9732b462e331e4b6d4acffe35e7cd
This changeset implements T89432 and related tickets and is based on exploration
done at the Prague Hackathon. The goal is to identify tests in MediaWiki core
that can be run without having to install & configure MediaWiki and its dependencies,
and provide a way to execute these tests via the standard phpunit entry point,
allowing for faster development and integration with existing tooling like IDEs.
The initial set of tests that met these criteria were identified using the work Amir did in
I88822667693d9e00ac3d4639c87bc24e5083e5e8. These tests were then moved into a new subdirectory
under phpunit/ and organized into a separate test suite. The environment for this suite
is set up via a PHPUnit bootstrap file without a custom entry point.
You can execute these tests by running:
$ vendor/bin/phpunit -d memory_limit=512M -c tests/phpunit/unit-tests.xml
Bug: T89432
Bug: T87781
Bug: T84948
Change-Id: Iad01033a0548afd4d2a6f2c1ef6fcc9debf72c0d
This was the only comment I could find that uses two curly brackets
for some reason. There are a few more with one curly bracket.
Change-Id: Iaed631916064e6be4895edd4c7a3d7de491e16c2
This was already used for external libraries. This commit
changes the order to be consistently 'New/Changed/Removed',
and adopts the pattern for configuration changes as well.
For improved scannability, the bullet points now start with
the name of the configuration setting(s), followed by a sentence,
with an optional ticket in brackets after the sentence(s).
* A number of bullet points under "Configuration changes" were
in fact, not configuration changes. These have been moved to
"New features" or "Other changes" for now.
* Add mention of the relevant configuration variable to some
of the release notes: $wgTidyDriver, `watchlistdays`,
$wgGroupPermissions, $wgGroupPermissions.
Also fix ReleaseNotesTest to count characters, not bytes,
this was causing it to count – as two, and € as three.
Change-Id: Ie89dac6408f8a8dafbf59efe73a11f4d282c0c6b