I'm developing an application where the notifications are highly important, so want to get some good test coverage.
I'm already using the Notification Fake (e.g. Notification::assertSentTo()) to assert that a certain notification class is going to be sent to a specific User / Contact (e.g. a class using Notifiable). However, I'd like to take things a step further and do some more testing.
The Fake doesn't seem to call the methods that "make" the notification content for the channels (e.g. toMail() or toNexmo()) - meaning that errors within these wouldn't be caught.
Ideally I'd like to test these "to" methods so I can test the actual notification content (e.g. Mail Subject, Mail Body, Nexmo SMS Content, Webhook Payload), making assertions that it contains specific strings (e.g. a verification code).
I've managed to do this by creating an instance of the notification and calling each of the "to" methods, and making assertions against the returned data (e.g. instances of MailMessage and NexmoMessage). Is there a better way of doing this?
Is there anything else that could be tested to ensure notification sending is as bug-free as possible?
I'm already testing the routesNotificationFor() methods in my model tests to ensure they return the expected values.