EVOLUTION-MANAGER
Edit File: unit-testing.md
--- title: Unit testing weight: 1 --- In your application's tests, if you are not seeding roles and permissions as part of your test `setUp()` then you may run into a chicken/egg situation where roles and permissions aren't registered with the gate (because your tests create them after that gate registration is done). Working around this is simple: In your tests simply add a `setUp()` instruction to re-register the permissions, like this: ```php public function setUp() { // first include all the normal setUp operations parent::setUp(); // now re-register all the roles and permissions $this->app->make(\Spatie\Permission\PermissionRegistrar::class)->registerPermissions(); } ```