* DeprecatedHooksTest: Don't use assertContains().
* Replace uses of deprecated asserts:
- assertFileNotExists() -> assertFileDoesNotExist()
* Update hierarchy of MediaWikiPHPUnitResultPrinter, since ResultPrinter
is an interface in PHPUnit 9.
* Remove temporary forward-compat methods.
* Remove directories that don't exist from tests/phpunit/suite.xml, since
they now make PHPUnit exit:
- tests/phpunit/skins, it used to have SideBarTest, then moved to
tests/phpunit/includes/skins
- tests/phpunit/documentation, it used to have ReleaseNotesTest, then
moved to tests/phpunit/unit/documentation
* Update configuration with --migrate-configuration and reformat.
* Avoid redefining getMockBuilder() in
ActionModuleBasedHandlerTestTrait, use a @method annotation instead.
* In RCCacheEntryFactoryTest, avoid using internal PHPUnit logic for
HTML validation, and use native PHP methods instead. The code was
copied from Xml::load (moved to \Xml\Loader::load in PHPUnit 9) and
simplified for this use case.
Bug: T243600
Bug: T262076
Change-Id: I851b9158b73d0cfc315eed9d63b15c54b05895e3
Using TestDox is imho not ideal to use by default:
* Far too noisy as a default, making it difficult to iterate by
not having previous output nearby.
* The custom "Logs generated" we add for debugging don't actually
show up, not in the original failure that is buried between success
mesages, and not in the summary.
This is imho a requirement both for CI and local dev.
* Test failures are immediately buried and flown past with a lot
of other information.
Proposal:
* Restore default printer as this commit does, with the previous
override for adding custom logs.
* Once MWTestDox works correctly per the above, enable it by
default for CI only, by adding `--printer MWTestDox` to
phpunit:entrypoint in composer.json, which is basically only
for use by CI.
The vendor/bin/php, composer phpunit, and phpunit.php calls,
and IDE integrations would would remain unaffected.
One can easily pass `--printer MWTestDox` to bin/phpunit if
preferred locally, or invoke `composer phpunit:entrypoint -- ...`
instead at that point.
Bug: T297287
Change-Id: I03391e2da1192156e220819d97ca7d8370199801
Switch PHPUnit to use the more verbose TestDox format, which allows
us to see exactly which tests have been executed. This is useful when
making changes to test configuration.
Use the MediaWikiPHPUnitResultPrinter to override the CliTestDoxPrinter
and use the actual class names / test method names, instead of the
prettified versions from TestDox, to improve greppability.
Bug: T297287
Change-Id: I9d8561ff868e6ff0a44d32120f2799b34d25e618
The TestListener interface is deprecated. This replacement has the
downside of using a public static property, but there seems to be no
other way to pass extra data to the printer (BTW: the ResultPrinter
class is internal, so it'd be even better if we could avoid subclassing
it).
Bug: T243600
Change-Id: I083146b7336ac09dfd077c8e6817553738282662
The previous output meant that when reviewing the build output,
it was quite hard to quickly find what the problem was and in
which test because the start of the result (which mentions the
test suite) and the expected/actual diff, were often separated
by dozens or hundreds of lines of "helpful" debug logs.
These are now moved to the after the expected/actual/stacktrace
portion so that "Name of test" and "expected/actual" remain
together.
Before
> 1) ResourceLoaderFilePathTest::testGetters
> === Logs generated by test case
> …
> …
> …
> …
> …
> …
> …
> ===
> Failed asserting that two strings are identical.
> --- Expected
> +++ Actual
> @@ @@
> -'dummy/pat'
> +'bla'
> /var/mediawiki/tests/phpunit/resourceloader/ResourceLoaderFilePathTest.php:22
After
> 1) ResourceLoaderFilePathTest::testGetters
> Failed asserting that two strings are identical.
> --- Expected
> +++ Actual
> @@ @@
> -'dummy/pat'
> +'bla'
> /var/mediawiki/tests/phpunit/resourceloader/ResourceLoaderFilePathTest.php:22
> === Logs generated by test case
> …
> …
> …
> …
> …
> …
> …
> ===
Change-Id: I31f1a4b730a0dd8597a059034b4e6abdc5f48552
This commit splits changes from Ic14f5debc53e55d6714 to reduce it to
only strictly needed things. It can be merged immediately.
Bug: T192167
Change-Id: I8c541a66ea13421dbe7fa51d197d5455cc4786eb
The initial implementation of reporting logs with test failures was
incorrect, it always reported the logs of the most recent test run.
Attach logs to the Test when a failure is reported and pull them
back out in the result printer.
Bug: T217489
Change-Id: I5aa55d6fa7a7ec03a2e71636b6b0366ea40605cb
When a unit test fails it is possible, perhaps even likely in some
cases, that some code that was run logged useful information about
how that failure came to be.
Help people out, tell them what happened!
Change-Id: I30bbc31799a65024868678d052fec9aafacc1aff