From the course: PHP: Testing Legacy Applications
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Building a scenario
- [Instructor] Alright, in a previous video, I showed you how I go and create my testing scenario by using pseudo code, in other words, plain English, so I can understand all the steps that I need in order to write a test. So now I'm going to show you how I go and change all the pseudo code into actual working code, and then we will have a working test by the end of this video that uses the real dependencies, 'cause in the future we're not going to explain how we turn these into doubles. So, what I usually do is, I literally go line-by-line and duplicate what I need. So, my first step I have here in my test is I need to create a Query Factory object. So I need to create a Query Factory object. I have a file called db_config that takes care of creating that for me, So I'm going to go into that file, copy the code, it's line six to 11, I'm going to paste that into my test. And as always, with every single time we change something in the test, we need to go back and run the test and make…
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.
Contents
-
-
-
-
-
-
Why test a legacy application?1m 57s
-
(Locked)
Identifying dependencies3m 20s
-
(Locked)
Planning a scenario5m 32s
-
(Locked)
Building a scenario6m 6s
-
(Locked)
Planning real to doubles4m 19s
-
(Locked)
Building real to doubles7m 7s
-
(Locked)
Refactor your tests4m 11s
-
(Locked)
Add getters and setters3m 58s
-
-