在 Lumen 中进行单元测试时跳过授权
Skip authorization while unit testing in Lumen
在对 Lumen 应用程序进行 运行 单元测试时,是否可以跳过授权中间件?
在测试用例的顶部添加以下内容:
<?php
use Laravel\Lumen\Testing\WithoutMiddleware;
class MyTest extends TestCase
{
use WithoutMiddleware;
...
当您再次 运行 单元测试时,测试用例将 运行 没有中间件的应用程序。
在对 Lumen 应用程序进行 运行 单元测试时,是否可以跳过授权中间件?
在测试用例的顶部添加以下内容:
<?php
use Laravel\Lumen\Testing\WithoutMiddleware;
class MyTest extends TestCase
{
use WithoutMiddleware;
...
当您再次 运行 单元测试时,测试用例将 运行 没有中间件的应用程序。