From the course: PHP: Design Patterns
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Challenge: Apply mock objects - PHP Tutorial
From the course: PHP: Design Patterns
Challenge: Apply mock objects
(airy cymbal) - When we want to test our objects, we want to Mock out certain behaviors. In this case, we're mock-deleting our user. In this exercise, implement a MockUser class that extends the user class to do what we need, which is nothing. Remember, we don't actually want to delete the user. This challenge is pretty straight forward in that you shouldn't have to modify index.php or database.php. Remember, there is not an actual database behind the scenes here, but we're trying to act like there is. Once you have a solution, check mine to see one approach.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.