Unit tests: Support unit tests in extensions and skins
authorKosta Harlan <kharlan@wikimedia.org>
Mon, 1 Jul 2019 19:33:54 +0000 (15:33 -0400)
committerKosta Harlan <kharlan@wikimedia.org>
Mon, 1 Jul 2019 20:21:01 +0000 (16:21 -0400)
commit1139a9af6ae8fa18db9645e4309c5b1bd40d9c8b
treeada3fee239934a7ac8038a4d331eae3e83ae6728
parent2e0cf0891444367942677692cf8efde87f19c3ef
Unit tests: Support unit tests in extensions and skins

For now only extensions with skin/extension.json which follow PSR-4 are
supported.

DefaultSettings is loaded in bootstrap to work around errors when unit tests are
run followed by integration tests (e.g. `vendor/bin/phpunit`)

Usage:

 - composer phpunit:unit will run all unit tests in core and any tests in
   `{extensions/skins}/tests/phpunit/unit` which also extend
   MediaWikiUnitTestCase, and which have an extension.json file
- Pass a specific directory to only run unit tests for a particular extension,
   e.g. `composer phpunit:unit -- extensions/GrowthExperiments`

Bug: T226911
Change-Id: I237a9f82e4d1b05cf2f08b3e4bb7ffcd8d47111c
includes/registration/ExtensionRegistry.php
phpunit.xml.dist
tests/phpunit/bootstrap.php