Commit graph

16 commits

Author SHA1 Message Date
Reedy
eb41565a9a Tests: Start marking some closures as static
Bug: T274036
Change-Id: Ib738ecd3bc23d34900bc268c8246702ac3655746
2021-02-06 19:57:42 +00:00
addshore
959bc315f2 MediaWikiTestCase to MediaWikiIntegrationTestCase
The name change happened some time ago, and I think its
about time to start using the name name!
(Done with a find and replace)

My personal motivation for doing this is that I have started
trying out vscode as an IDE for mediawiki development, and
right now it doesn't appear to handle php aliases very well
or at all.

Change-Id: I412235d91ae26e4c1c6a62e0dbb7e7cf3c5ed4a6
2020-06-30 17:02:22 +01:00
Max Semenik
b04e62f31d phpunit: Simplify StructureTest
* Get rid of a long regexp that had to be maintained and
  was broken anyway, resulting in a false negative.
* Fix that false negative.
* Make the failures array a bit more readable.

Bug: T248075
Change-Id: I4e4e5d6487d23b0d64f29c113d84bddce758e516
2020-03-29 15:40:45 +00:00
Max Semenik
4a17fd1202 Upgrade PHPUnit to version 7
Going directly to 8 is too much pain.

Depends-On: Iafcea151389663d79e70ad6ab3741ce8b2e25cac
Bug: T192167
Change-Id: I77ea560f4a5344bd1c356ecc3e7857968ad829b8
2019-11-20 21:02:33 -08:00
Legoktm
4e35134f7a Revert "Separate MediaWiki unit and integration tests"
This reverts commit 0a2b996278.

Reason for revert: Broke postgres tests.

Change-Id: I27d8e0c807ad5f0748b9611a4f3df84cc213fbe1
2019-06-13 23:00:08 +00:00
Máté Szabó
0a2b996278 Separate MediaWiki unit and integration tests
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
2019-06-13 22:56:31 +02:00
Gergő Tisza
45d4e8d13a Exempt structure tests from @covers checks
@covers does not make any sense for structure tests, which either
do not cover any PHP lines (they test things like configuration or
messages), or cover lines which cannot be determined at the time
of writing the tests (e.g. they cover all classes implementing a
certain interface). Requiring @coversNothing to be manually added
for all of them is a waste of developer time.

tests/phpunit/suite.xml has forceCoversAnnotation=true so removing
the annotations will not change test coverage, these files will
still be skipped.

Change-Id: I27cb58e92341b9b1a76f109701f5bc843adbaa9b
2019-06-11 21:40:14 +00:00
Umherirrender
480b653720 StructureTest::testUnitTestFileNamesEndWithTest() should not shell out
Bug: T169005
Change-Id: I17b35f31c3989ca0b9056252866a45434c31a105
2018-09-18 20:34:28 +02:00
Kunal Mehta
4acb7ed51c Add @coversNothing to tests that don't cover specific PHP classes
Change-Id: Idbd364561bc28547e9fac20d7a80b9a44edf14a9
2018-06-12 13:27:40 -07:00
Lucas Werkmeister
4a1e59b63d Accept non-fully qualified TestCase in StructureTest
This makes StructureTest also recognize test classes which look like

    use PHPUnit\Framework\TestCase;

    class FooTest extends TestCase {

instead of

    class FooTest extends \PHPUnit\Framework\TestCase {

This form is preferred, for instance, in Wikibase code.

Bug: T188276
Change-Id: I5bef035df33d317893ad3ba195ecb75f3b09a62f
2018-02-26 18:06:27 +01:00
Umherirrender
63d96c15fd build: Updating mediawiki/mediawiki-codesniffer to 16.0.0
Change-Id: I59b59f79bbf3ce4feff3b3a20c1c31bc16370531
2018-02-17 13:29:13 +01:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
umherirrender
b0cfcd0fcb Add missing @return and @param to doc blocks
Change-Id: I9d99ba1968ed8f97624d957754c8847dfe1b41da
2014-08-27 21:57:45 +02:00
Brian Wolff
6beee2535f Restructure Media related tests to avoid duplicated code
Change-Id: I4428d38e0199b12255f3746e79f8093259a03da1
2014-05-27 11:01:12 +02:00
Timo Tijhof
9976cef4ed tests: Add ResourceLoaderTestCase and abstract context creation
Change-Id: Ib4b265256e60a2f2109da73dc7edba6a75587ce2
2014-03-07 20:09:59 +01:00
Antoine Musso
f87320bdac tests: group structures tests in their own directory
The phpunit root directory has two test file:

 AutoLoaderTest.php
 StructureTest.php

The later was registered in phpunit under the `structure` test suite
while the former was not registered and hence never run (bug 47750).

This patch moves both files under the `structure` subdirectory and
change the suite to look in that directory.  That will avoid us having
to manually maintain a list of test files.

Updated the __DIR__ in StructureTest.php.

Change-Id: I419c9157f32bdf7e1ff26a42f4bb3f3922b7be37
2013-05-21 12:33:42 +02:00
Renamed from tests/phpunit/StructureTest.php (Browse further)