title: How does one load gate defines when testing a Laravel application?
body: <p>I'm writing tests for a Laravel application. In my <code>AuthServiceProvider-&gt;boot()</code>, I define a number of user abilities with <code>$gate-&gt;define()</code> based on a permissions table in my database.</p>
  
  <p>Basically this:</p>
  
  <pre><code> foreach ($this-&gt;getPermissions() as $permission) {
              $gate-&gt;define($permission-&gt;name, function ($user) use ($permission) {
                  return $user-&gt;hasPermission($permission-&gt;name);
              });
          }
  </code></pre>
  
  <p>In my tests I'm creating permissions on the fly, but the <code>AuthServiceProvider</code> has already booted up, which means I can't verify user permissions with <code>@can</code>, <code>Gate</code>, etc.</p>
  
  <p>Is there a proper way to deal with this issue?</p>