filmov
tv
PHP Testing Tutorial: Test Doubles - PHPUnit Mocks and Stubs
Показать описание
These are ESSENTIAL PHP testing skills! Learn how to replace PHP objects with mock objects so that you can test your code in isolation. Learn the difference between PHPUnit Stubs and PHPUnit MockObjects and all of the cool things you can do with them to make testing easier.
💻Source code here:
🆓 Join GaryClarke Tech and claim your $49 Docker + PHP course for FREE here:
⭐This is a sample from my Testing PHP course. Mocking is put to practical use in the full course:
👇Follow me on Social Media:
💕Show support:
Chapters:
0:00 Introduction to test doubles
1:45 Install PHPUnit and setup autoloading
3:50 Create a test file
5:17 Create a mock object
8:35 Set mock expectations
11:45 Faking method-returned values
13:12 Default mock method return values
16:35 Mocking consecutive method returns
20:38 Mock throwing exceptions
23:47 Complex mock returns using callbacks
28:20 Test correct method args passed to mocked method
30:30 Passing multiple args to mocked method
33:50 Complex mock method args using callbacks
40:13 Custom mocks using the Mock Builder
💻Source code here:
🆓 Join GaryClarke Tech and claim your $49 Docker + PHP course for FREE here:
⭐This is a sample from my Testing PHP course. Mocking is put to practical use in the full course:
👇Follow me on Social Media:
💕Show support:
Chapters:
0:00 Introduction to test doubles
1:45 Install PHPUnit and setup autoloading
3:50 Create a test file
5:17 Create a mock object
8:35 Set mock expectations
11:45 Faking method-returned values
13:12 Default mock method return values
16:35 Mocking consecutive method returns
20:38 Mock throwing exceptions
23:47 Complex mock returns using callbacks
28:20 Test correct method args passed to mocked method
30:30 Passing multiple args to mocked method
33:50 Complex mock method args using callbacks
40:13 Custom mocks using the Mock Builder
Комментарии