Главная
Study mode:
on
1
Introduction to test doubles
2
Install PHPUnit and setup autoloading
3
Create a test file
4
Create a mock object
5
Set mock expectations
6
Faking method-returned values
7
Default mock method return values
8
Mocking consecutive method returns
9
Mock throwing exceptions
10
Complex mock returns using callbacks
11
Test correct method args passed to mocked method
12
Passing multiple args to mocked method
13
Complex mock method args using callbacks
14
Custom mocks using the Mock Builder
Description:
Learn essential PHP testing skills in this comprehensive tutorial on PHPUnit Test Doubles. Discover how to replace PHP objects with mock objects for isolated code testing. Explore the differences between PHPUnit Stubs and PHPUnit MockObjects, and master various techniques to simplify your testing process. Cover topics such as creating mock objects, setting expectations, faking method returns, handling exceptions, using callbacks for complex returns, testing method arguments, and creating custom mocks with the Mock Builder. Gain practical knowledge to enhance your PHP testing capabilities and improve your overall code quality.

PHPUnit Test Doubles - Mocks and Stubs Tutorial

Gary Clarke
Add to list