News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

NetTuts.com:
Refactoring Legacy Code Part 5 - Game's Testable Methods
May 27, 2014 @ 09:29:33

NetTuts.com continues on with their next part of their refactoring series today in this new post focusing on (unit) testing more of the application. This includes both the code for the tests and the before/after of the refactored code.

Old code. Ugly code. Complicated code. Spaghetti code. Gibberish nonsense. In two words, Legacy Code. This is a series that will help you work and deal with it. In our previous tutorial, we tested our Runner functions. In this lesson, it is time to continue where we left off by testing our Game class. [...] It is much better to start testing it by its short, testable methods. This is what we'll do in this lesson: find and test those methods.

They start with creating a new "Game" object and finding the first testable method in the class. The tutorial works through this and other related methods to build up a set of "Game" tests and eventually doing some refactoring on the tests themselves. With one method down and tested, they move on to finding and creating the tests for the next few testable methods, looking for something "controllable" that makes for easy testing.

0 comments voice your opinion now!
refactor legacy code series part5 unittest game method

Link: http://code.tutsplus.com/tutorials/refactoring-legacy-code-part-5-games-testable-methods--cms-21213

blog comments powered by Disqus

Similar Posts

Sebastian Bergmann's Blog: PHPUnit 3.1.0 (Release Announcement)

PHPMaster.com: An Introduction to Mock Object Testing

Jani Hartikainen's Blog: Unit testing 4: Mock objects and testing code which uses the database

Jani Hartikainen's Blog: Using unit tests as requirements when refactoring

Mike Lively's Blog: PHPDBUnit - Testing DB interaction with PHPUnit


Community Events

Don't see your event here?
Let us know!


performance opinion extension version introduction php7 application voicesoftheelephpant laravel community interview framework release library series example symfony2 podcast api conference

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework