I am creating an application which dependant on the day that it runs, it creates different reports.
So if it is a Monday @ 1am, I will create a weekly report, if it is the 1st of the month @ 1.30am, it will create a monthly report.
My initial approach uses one class. It has a property which is an array, that maps each report to a function.. The calling script calls the run() method on the class, which in turn loops through the array and calls the function for each report.
How do I test this? I want to have a decent suite of unit tests to cover the calculations.
Do I create two functions for each report? One which grabs the data from the DB, and another to do the calculations (which would be testable via params). This seems long winded though! I would have 24 functions instead of 12.
Confused about the best way to do this.
Thanks!
Aucun commentaire:
Enregistrer un commentaire