[eluser]Eric Barnes[/eluser]
I haven't gotten into test first development. I seem to always write a method and then test it.
But the biggest areas you would want to test in what you described would be order processing. IE: calculating discounts, taxes, etc. Then work from there.
As a rule of thumb any method especially in libraries or models can be tested and it is a good to get in the habit of testing them. But don't just test for what you know, test for any weird situation you can through at it.
Here is an example:
Code:
function subtract($one, $two)
{
return $one - $two;
}
// Actual test
public function test_subtract()
{
$this->assertEqual(subtract(1,1), 0);
$this->assertEqual(subtract(5,4), 1);
$this->assertEqual(subtract(4,5), '-1');
$this->assertEqual(subtract(4,''), '1');
$this->assertEqual(subtract('',''), '1');
$this->assertEqual(subtract('one','two'), '1');
$this->assertEqual(subtract(array(),'two'), '1');
// etc...
}
As you can see with that test I am using that will fail and your method should then account for it.