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

YouTube

PHPUnit Test Doubles - Mocks and Stubs Tutorial

Gary Clarke via YouTube

Overview

Google, IBM & Meta Certificates – 40% Off
One Coursera Plus subscription covers most Professional Certificates on Coursera.
Unlock All Certificates
This course teaches practical PHPUnit test-double techniques for isolating PHP code during testing. It covers setup, mock expectations, return values, exceptions, callbacks, argument verification, and custom mocks.

Syllabus

Introduction to test doubles
Install PHPUnit and setup autoloading
Create a test file
Create a mock object
Set mock expectations
Faking method-returned values
Default mock method return values
Mocking consecutive method returns
Mock throwing exceptions
Complex mock returns using callbacks
Test correct method args passed to mocked method
Passing multiple args to mocked method
Complex mock method args using callbacks
Custom mocks using the Mock Builder

Taught by

Gary Clarke

Reviews

Start your review of PHPUnit Test Doubles - Mocks and Stubs 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.