PHPUnit
   HOME

TheInfoList



OR:

PHPUnit is a
unit testing Unit testing, component or module testing, is a form of software testing by which isolated source code is tested to validate expected behavior. Unit testing describes tests that are run at the unit-level to contrast testing at the Integration ...
framework for the PHP programming language. It is an instance of the
xUnit xUnit is a label used for an automated testing software framework that shares significant structure and functionality that is traceable to a common progenitor SUnit. The SUnit framework was ported to Java by Kent Beck and Erich Gamma as JUn ...
architecture for unit testing frameworks that originated with SUnit and became popular with
JUnit JUnit is a test automation framework for the Java programming language. JUnit is often used for unit testing, and is one of the xUnit frameworks. JUnit is linked as a JAR at compile-time. The latest version of the framework, JUnit 5, resides ...
. PHPUnit was created by Sebastian Bergmann and its development is hosted on
GitHub GitHub () is a Proprietary software, proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug trackin ...
.


Purpose

PHPUnit is based on the idea that developers should be able to find mistakes in their newly committed code quickly and assert that no code regression has occurred in other parts of the code base. Much like other
unit testing Unit testing, component or module testing, is a form of software testing by which isolated source code is tested to validate expected behavior. Unit testing describes tests that are run at the unit-level to contrast testing at the Integration ...
frameworks, PHPUnit uses assertions to verify that the behavior of the specific component - or ''"unit"'' - being tested behaves as expected.


Benefits

The goal of unit testing is to isolate each part of the program and show that the individual parts are correct. A unit test provides a strict, written contract that the piece of code must satisfy. As a result, unit tests find problems early in the development cycle. PHPUnit can output test results in a number of different formats, including
JUnit JUnit is a test automation framework for the Java programming language. JUnit is often used for unit testing, and is one of the xUnit frameworks. JUnit is linked as a JAR at compile-time. The latest version of the framework, JUnit 5, resides ...
XML and TestDox.


Vulnerabilities

A vulnerability that allowed attackers to execute remote code via PHPUnit was discovered in late 2017. By sending a payload of PHP code to a file that is part of PHPUnit, an attacker could execute PHP code on the webserver.


References


External links

* {{PHP Extreme programming PHP frameworks Unit testing frameworks Software using the BSD license