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

Challenge: Apply mock objects - PHP Tutorial

From the course: PHP: Design Patterns

Start my 1-month free trial

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.

Contents