Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

PHP Unit Testing with PHPUnit Tutorial

Gary Clarke via YouTube

Overview

Learn how to test PHP code using PHPUnit, including setting up and tearing down test classes, using test doubles and mocking, configuring phpunit.xml, autoloading classes, and testing errors and exceptions. The course covers making assertions, running tests from the command line, using colors in test feedback, testing objects and classes, and grouping tests. The teaching method includes practical demonstrations and examples. This course is intended for PHP developers looking to improve the quality and reliability of their code through unit testing.

Syllabus

Introduction / overview
Install PHPUnit
Create a test file
Run a test from the command line
Making assertions
Tests which fail
Using colors in test feedback
Testing objects and classes
Using the '@test' annotation
Using filter option to run individual tests
Configuring phpunit usng phpunit.xml
Autoloading classes in tests
Test scope
The setUp method
The tearDown method
Testing errors and exceptions
Test doubles
Creating mock objects
Mocking methods
Injecting mock test dependencies
Test number of times a method is expected to be called
Grouping tests

Taught by

Gary Clarke

Reviews

Start your review of PHP Unit Testing with PHPUnit Tutorial

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.