Mocking Dependencies in Unit Tests with Phake
Offered By: PHP UK Conference via YouTube
Course Description
Overview
Explore mocking dependencies in unit tests using Phake in this PHP UK Conference talk. Delve into Test-Driven Development (TDD) principles and learn how to effectively mock dependencies in object-oriented programming. Discover the advantages of Phake over PHPUnit's built-in mocking API, including its more intuitive interface and expanded feature set. Follow along as the speaker demonstrates various mocking techniques, including stubbing behaviors, handling private and static methods, working with final methods and magic methods, verifying invocations, and utilizing PHPUnit constraints. Gain insights into creating more robust and maintainable unit tests for complex PHP applications.
Syllabus
Intro
Mike Lively
Example Class Under Test
Test Doubles
Example Test With Stubbing
Stub Behaviors
private Methods
Stubbing static Method Calls
final Methods
Stubbing final Method Calls
Magic Methods
Verifying Identical Invocations
Verifying No Interaction
PHPUnit Constraints
Wildcard Parameters
PHPUnit: Mocking
PHPUnit: Verifying Order
Taught by
PHP UK Conference
Related Courses
Ruby on Rails: An IntroductionJohns Hopkins University via Coursera Internet of Things Capstone: Build a Mobile Surveillance System
University of California, San Diego via Coursera Engineering Maintainable Android Apps
Vanderbilt University via Coursera Orientação a Objetos com Java
Instituto Tecnológico de Aeronáutica via Coursera TDD – Desenvolvimento de Software Guiado por Testes
Instituto Tecnológico de Aeronáutica via Coursera