Manual:PHP unit testing

Quick Start
To get started writing unit tests as quickly as possible, copy and then customize SampleTest.php.

While the above will be a good way to get started writing tests, you'll want to read the PHPUnit Manual to understand best practices.

Best Practices
Unit testing in MediaWiki is performed using the PHPUnit framework, a PHP rendition of JUnit. This document serves to prescribe a set of best practices for writing and organizing unit tests for MediaWiki core and extension software.

Before contributing to this document, please be sure you have read through the documentation on how to write and organize tests. Developers should avoid inventing new conventions or borrowing conventions from other frameworks; using the already well-established PHPUnit conventions will serve to make MediaWiki's tests both useful and usable.

Status
Work has been done to reorganize PHPUnit tests located in /maintenance/tests into a properly organized directory tree which mirrors the sources of the units under test. This work can be seen in the main branch.

At the DC Hack-a-ton, a lot of work was done on clarifying how to write tests.