public function setUp() { parent::setUp(); // We need to login a default user for convenience $user = User::create(['email' => '*****@*****.**']); auth()->login($user); // We have to reboot event listeners due to an issue with phpunit // @link http://stackoverflow.com/questions/17428050/laravel-4-model-events-dont-work-with-phpunit Category::flushEventListeners(); Category::boot(); Comment::flushEventListeners(); Comment::boot(); Quote::flushEventListeners(); Quote::boot(); }