I am writing my first Artisan team in Laravel 4.1 and wanted some ideas on how to test it. My team is doing one thing (for now). It basically deletes table entries (notes) from the database, which is a given number of days.
Command example:
OneTimeNote:delete
The team works with flying flowers. But I wrote the team first for training purposes, and now I want to follow it with the test. I am using PHPUnit and Mockery.
Command Code:
http://pastebin.com/index/dZrxpt8x
As you can see, I introduce my implementation of Notes (for abstraction), and then I execute one of its methods "deleteNotesOlderThan (int $ days)". As I said, all this works great and dandy. My problem starts when I try to verify this.
Team Test : http://pastebin.com/6UwxGvcN
If you look at the code, you will see where I am stuck. How can I build my Note method and generate a command test? Also, what things should I test with this particular command?
Thank you in advance
source
share