I have a Laravel 4 test class with a number of tests for which I want to seed my database before running the tests. Using the setup() function to reseed for each test takes far too long. However, when I try seeding in the static setupBeforeClass() function or in the constructor, I obviously can't use the $this->seed() method.
But neither can I use programmatic Artisan commands, because when I do I get the following error:
PHP Fatal error: Class 'Artisan' not found in <test class name>
Here is the code I'd like to use to seed:
Artisan::call('migrate:refresh'); Artisan::call('db:seed', array('--class'=>'TestSeeder');
Please let me know how I can seed my database once per test class rather than per test case