PHPUnit Test Doubles - Mocks and Stubs Tutorial

PHPUnit Test Doubles - Mocks and Stubs Tutorial

Gary Clarke via YouTube Direct link

Set mock expectations

5 of 14

5 of 14

Set mock expectations

Class Central Classrooms beta

YouTube videos curated by Class Central.

Classroom Contents

PHPUnit Test Doubles - Mocks and Stubs Tutorial

Automatically move to the next video in the Classroom when playback concludes

  1. 1 Introduction to test doubles
  2. 2 Install PHPUnit and setup autoloading
  3. 3 Create a test file
  4. 4 Create a mock object
  5. 5 Set mock expectations
  6. 6 Faking method-returned values
  7. 7 Default mock method return values
  8. 8 Mocking consecutive method returns
  9. 9 Mock throwing exceptions
  10. 10 Complex mock returns using callbacks
  11. 11 Test correct method args passed to mocked method
  12. 12 Passing multiple args to mocked method
  13. 13 Complex mock method args using callbacks
  14. 14 Custom mocks using the Mock Builder

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.