# PHPUnit

> PHPUnit is an open-source testing framework for PHP that developers use to write automated tests comparing actual results with expected ones.

Original page: https://t10.de/en/glossary/phpunit
Publisher: total10 GmbH, https://t10.de/en/glossary

A test, in PHPUnit terms, is code that checks whether other code behaves as expected. Technically, each test is a public method of a test class, in which checks called assertions compare an actual value with the expected one. The [PHPUnit manual](https://docs.phpunit.de/en/13.4/writing-tests-for-phpunit.html) counts a test as passed when none of its assertions fail, all its expectations are met and no unexpected exception is thrown. One goal of PHPUnit is that any number or combination of tests can be run together, up to every test in a project; for this, tests are grouped into a test suite.

PHPUnit calls itself a programmer-oriented testing framework for PHP that follows the xUnit architecture for unit testing frameworks. It is released under the BSD 3-Clause licence, with Sebastian Bergmann as copyright holder. Static analysis tools such as PHPStan complement the tests.

Automated tests are how we check that a change does not quietly break something that already works. They run after every change and before every update, and we keep adding to them. On a knowledge platform we look after for a logistics provider in the pharmaceutical industry, for example, PHPUnit tests cover individual components, the way they work together and complete features.

## See also

- [PHPStan](https://t10.de/en/glossary/phpstan): PHPStan is an open-source static analysis tool for PHP that finds errors in code without running it and without the need to write tests.
- [Non-GxP](https://t10.de/en/glossary/non-gxp): Non-GxP describes a system that its operator does not classify as GxP-relevant; PIC/S guidance uses the term without defining it formally.
- [QA](https://t10.de/en/glossary/qa): QA is short for quality assurance; in the EU, both good manufacturing practice (GMP) and good distribution practice (GDP) are defined as part of it.

## Where the term appears

- [What non-GxP means for pharma business software](https://t10.de/en/blog/non-gxp-pharma-logistics)
- [Case study: knowledge platform for pharma logistics](https://t10.de/en/blog/knowledge-platform-pharma)
- [Stock alerts in pharma logistics, without a web shop](https://t10.de/en/blog/stock-alerts-pharma)

## Sources

1. [README des Repositorys sebastianbergmann/phpunit (Branch main)](https://raw.githubusercontent.com/sebastianbergmann/phpunit/main/README.md), Sebastian Bergmann (GitHub sebastianbergmann/phpunit), accessed 2026-11-07
2. [PHPUnit 13.4 Manual, 2. Writing Tests for PHPUnit](https://docs.phpunit.de/en/13.4/writing-tests-for-phpunit.html), PHPUnit (docs.phpunit.de), accessed 2026-11-07
3. [LICENSE des Repositorys sebastianbergmann/phpunit (Branch main)](https://raw.githubusercontent.com/sebastianbergmann/phpunit/main/LICENSE), Sebastian Bergmann (GitHub sebastianbergmann/phpunit), accessed 2026-11-07
4. [PHPUnit 13.4 Manual, Organizing Tests](https://docs.phpunit.de/en/13.4/organizing-tests.html), PHPUnit (docs.phpunit.de), accessed 2026-11-07
