I have set up my project so that a user can specify if they would like their notifications instantly, daily, weekly and via sms, email, or just in their dashboard.
So if a user has said 'instantly' then I fire off an sms/email right away.
If they have said daily/weekly, then I run a job with the
Scheduler which checks (at the right time) if a user has any unread notifications and send them an email/sms alerting them to how many unread notifications they have.
All good. Now I want to write a test around this.
This means I need to seed the database with some notifications against a user's account, but I can't figure out a good, clean, reproducible way to do this. I'm sure I'm just being dumb. The options I've thought of are:
Notificationclass. This feels wrong as my test shouldn't expect the existence of a certain
Notificationclass to run.
TestNotificationclass. This is doable, but seems messy and under which namespace would it be stored? Along with the other
Notificationmodel. I tried this but couldn't get it to work, but maybe this is the correct way?
I would really appreciate your thoughts.