jeudi 30 juillet 2015

How to write effective PHPUnit test cases

I've recently start writing test cases for my Angularjs app in Jasmine, I now want to start writing them for my PHP classes too.

Up until now i've basically been:

  • asserting that if the wrong sort of data/datatype is parsed to the method that it throws and exception
  • checking roughly that the right thing happens in the method (e.g. items are removed from arrays)
  • and that the right data type is returned from the method.

Is there anything else that I should be checking? Is any of this overkill already? Are there any tips that anyone can give me to writing really robust and effective test cases?

Aucun commentaire:

Enregistrer un commentaire