Before we can start adding Brain Monkey functionality to our tests, we need a test class. Let’s create that together in this episode.
Here are the pro tips that I share in this episode:
- Load all of the needed source files in the
setUp()method after the
parent::setUp(). Why? Before we can redefine a function, Patchwork needs to load first and then the original source code.
- Load only the source files from the package (plugin or theme) that you are testing. Do not load WordPress core or other third party files. Why? You only load the original source code when you will run the original function in your test suite. I explain it further in the video.
Don’t repeat yourself. Don’t repeat yourself. Don’t repeat yourself.
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