What’s the suggested pattern to use when unit testing methods that don’t live inside a class?
(Or is the idea that all code should live inside a class, perhaps as a static method?)
What’s the suggested pattern to use when unit testing methods that don’t live inside a class?
(Or is the idea that all code should live inside a class, perhaps as a static method?)
The same with a object, you run it and check the output. Its pattern is the same.
Sorry, my question must not have been clear.
Given that PHPUnit groups tests for class X into XTest, what is the pattern for methods outside a class? Create a fictitious GlobalTest?
Not looking for a howto, looking for best practices.
You are talking about the PHPUnit infrastructure to creating a test unit? I thought you was planning to change your code to suite PHPUnit or something.
Uh, no - please see subject and first post for the question.
class NameThatDescribesTest extend TestUnit // [Drawing a blank on PHPUnits naming at the moment]
{
// test code here....
}
Only one way to make a testunit in PHPUnit as fas as I know.