Testing your Code Using PHPUnit

This tutorial demonstrates how to create and run PHPUnit tests on your code. You will learn how to create and run single unit test cases and test suites containing a number of test cases.

Unit testing is a procedure to test your code to ensure that individual units of source code are working properly and that the right output is being generated. Tests can be run on all or some functions within files, meaning that tests can be conducted before the file has been fully developed. Each test case should be independent of others to ensure that test results can pinpoint the location of the error.

Running unit tests can ensure that your code is stable and functioning correctly, and can help you to diagnose errors.

Tutorial Content

In this tutorial, you will learn:

Provides Items

  • Throughout the tutorial, you will be provided with code snippets to insert in your project.


Related Media

To better understand the procedures described in this tutorial, watch this video: