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

phpPatterns.com:
Mocking Functions in Simple Test
Nov 01, 2005 @ 12:21:53

phpPatterns.com has this new article posted today to show how you can create "mock functions" that SimpleTest won't have a problem with.

When dealing with external projects that you either want to re-use parts of or refactor, being able to write unit tests is often a big problem, especially if it’s written in procedural code.

Being able to "mock" aFunctionIDontWantToTest in a similar manner to Mock Objects would be a big help.

He demonstrates the method, creating the mock objects directly/staticly in the MockFunction class...

tagged:

Link:


Trending Topics: