From the course: PHP: Testing Legacy Applications

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Planning real to doubles

Planning real to doubles

From the course: PHP: Testing Legacy Applications

Start my 1-month free trial

Planning real to doubles

- [Instructor] Okay, so you've seen how I turn my pseudocode into this working test that you have in front of you. Now the next step is, I'm going to create a test that uses test doubles so that we no longer need to talk directly to the database. So the first step is we're going to create an empty test, and then I'm going to write the pseudocode that I'm going to later turn into code. So we can do the same thing with the annotation, and then we will call this test function sortOrderWorksAsExpectedWithDoubles. We have the assertion in here, but we're not going to run it just yet, because first, I want to go over the pseudocode. You'll see how it changes, how we now go from one to use real things to using doubles, so what I say in this pseudocode, plan changes. So if we go over what we have here already on lines 14 through 19, where I'm describing the test, I'm going to now describe as if we're using doubles, so as before, we had a QueryFactory object, I'm going to need to create a…

Contents