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

Building a scenario

From the course: PHP: Testing Legacy Applications

Start my 1-month free trial

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…

Contents