在流明中进行单元测试时跳过授权

问题描述 投票:0回答:1

在为Lumen应用程序运行单元测试时,是否可以跳过授权中间件?

middleware lumen lumen-5.8
1个回答
0
投票

在测试用例的顶部添加以下内容:

<?php

use Laravel\Lumen\Testing\WithoutMiddleware;

class MyTest extends TestCase
{
    use WithoutMiddleware;
...

当再次运行单元测试时,测试用例将在没有中间件的情况下运行应用程序。

© www.soinside.com 2019 - 2024. All rights reserved.