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.

Building real to doubles

Building real to doubles

From the course: PHP: Testing Legacy Applications

Start my 1-month free trial

Building real to doubles

- [Narrator] Okay I showed you an example of how I would write all the pseudo-code that we would need to turn this test that used real dependencies into one that uses doubles. Now, rather than make you sit around and watch me for 45 minutes make syntax errors and mumble to myself and go read up on how different parts of the application work, I went and implemented the entire test. So this test actually does pass. Now I want to go over every little section of this test to explain what's going on, because I'm sure for many of you a lot of what's going on here is not obvious, and I want it to be obvious for you. Okay, so now we're ready to go from the pseudo-code where we've outlined all the doubles that we need to create to actually creating the doubles. Now the tool that I'm using is Mockery. I've mentioned it before, Mockery is a stand alone framework for creating test doubles. It's a little bit different from the built in one that comes with PHPUnit, and again that's a little bit…

Contents