PHPUnit is an open-source testing framework for PHP that developers use to write automated tests comparing actual results with expected ones.
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 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 PHP PHP is a widely used, general-purpose, open-source scripting language that is especially suited to web development; the name is a recursive acronym for 'PHP: Hypertext Preprocessor'. 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 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. Read in the glossary → 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.
Where the term appears
See also
-
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.
Cross-cutting
-
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.
Pharma
-
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.
Pharma
Sources
-
README des Repositorys sebastianbergmann/phpunit (Branch main) (opens in a new tab)
Sebastian Bergmann (GitHub sebastianbergmann/phpunit) accessed
-
PHPUnit 13.4 Manual, 2. Writing Tests for PHPUnit (opens in a new tab)
PHPUnit (docs.phpunit.de) accessed
-
LICENSE des Repositorys sebastianbergmann/phpunit (Branch main) (opens in a new tab)
Sebastian Bergmann (GitHub sebastianbergmann/phpunit) accessed
-
PHPUnit 13.4 Manual, Organizing Tests (opens in a new tab)
PHPUnit (docs.phpunit.de) accessed