【问题标题】:Laravel actingAs guestLaravel 代理客串
【发布时间】:2020-07-07 12:34:46
【问题描述】:

Laravel 提供了一种authenticate a given user during HTTP testing 的方法

$this->actingAs($user);

有没有办法在同一个测试中取消对 $user 的身份验证?

【问题讨论】:

    标签: laravel authentication testing


    【解决方案1】:

    是的,你可以使用这个来取消身份验证:

    Auth::logout();
    

    https://laravel.com/docs/7.x/authentication#logging-out

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-03-09
      • 2019-06-23
      • 2017-03-27
      • 1970-01-01
      • 2018-06-17
      • 2018-01-26
      • 2019-02-01
      相关资源
      最近更新 更多