How to write Unit tests for PyroCMS modules
Created 6 years ago by araminho

After installing a custom module I have "tests" directory, where I can see a lot of files intended to create tests. For example, "Unit" directory contains CollectionTest, CriteriaTest, ModelTest and many others. But all of them are empty and not implemented. How can I fill all those tests and what should I test in each of them? Is there any good practice to do that?

ryanthompson  —  6 years ago

Generally I test each method that I have defined in such classes. But it's really up to you. I think one per method is a starting point - and if you have anything more complicated you want test you can do that as well.