Behind the Scenes of Redefining a Function
Lab: Unit Testing with Brain Monkey
Video Runtime: 20:31
In the last episode, we talked about the philosophy of unit testing, i.e. testing in isolation without the function’s dependencies. In order to test in isolation, we need to know what each dependent function will do within the context of that test (i.e. given conditions) and then write a function that redefines the original in order to force it to do what it should. In this episode, you and I will dive into what is happening between the scenes in the PHP internals of user-defined names and memory. I’ll give you an overview to help you visualize how Brain Monkey through Patchwork allows you to dynamically (on-the-fly) redefine a previously declared function.
You will grow in this profession when you incrementally and systematically stretch yourself....bit-by-bit.
Episodes
Total Lab Runtime: 03:21:08
- 0 Lab Setupfree 07:07
- 1 The Problem - Why We Need to Simulatefree 24:50
- 2 Behind the Scenes of Redefining a Functionfree 20:31
- 3 Brain Monkey's Toolset Overviewpro 09:04
- 4 Anatomy of the Test Expectationpro 11:51
- 5 setUp and tearDownpro 09:51
- 6 Create a Test Classpro 20:42
- 7 `when()`pro 14:23
- 8 `when()` - Behavior Optionspro 14:26
- 9 `when()` - Code Challengepro 08:27
- 10 `expect()`pro 11:40
- 11 `with()`pro 05:44
- 12 More with `with()`pro 10:02
- 13 `with()` - Code Challengepro 09:53
- 14 `expect()` - Behavior Optionspro 07:47
- 15 `andAlsoExpectIt()`pro 10:46
- 16 `stubs()`pro 04:04