Overview
Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Explore the world of PHP test doubles in this comprehensive 51-minute video tutorial. Master the art of replacing objects in your PHP tests using stubs and mocks, a crucial skill for more efficient and focused code testing. Dive into topics such as PHPUnit test doubles, testing expectations, faking method return values, and handling consecutive returns. Learn how to throw exceptions from stubbed methods, utilize return callbacks, and verify that faked methods receive the correct arguments. Discover techniques for testing with callbacks and get acquainted with the Mock Builder. By the end of this tutorial, gain the knowledge to elevate your PHP testing practices and improve your overall code quality.
Syllabus
PHPUnit Test Doubles
Testing Expectations
Faking Method Return Values
Testing Consecutive Returns
Throwing Exceptions From Stubbed Methods
Will Return Callback
Test Faked Methods Receive Correct Args
Test Correct Args With Callbacks
The Mock Builder
Taught by
Gary Clarke