取消定义 withoutExceptionHandling()

Undefind withoutExceptionHandling()

我正在尝试 运行 我在 laravel 6 (windows 10) 上的单元测试与著名的:

this->withoutExceptionHandling();

但是我得到这个错误:

Error: Call to undefined method Tests\Unit\ExampleTest::withoutExceptionHandling()

我没有更改任何设置,当然它被定义在:

Illuminate\Foundation\Testing\Concerns\InteractsWithExceptionHandling

我什至尝试过:

"use Illuminate\Foundation\Testing\Concerns\InteractsWithExceptionHandling;"

但这仍然没有任何作用。

这是一个简单的测试文件,应该可以正常工作。

<?php

namespace Tests\Unit;


use Illuminate\Foundation\Testing\Concerns\InteractsWithExceptionHandling;
use Tests\TestCase;

class ExampleTest extends TestCase
{
    use InteractsWithExceptionHandling;

    /**
     * A basic test example.
     *
     * @return void
     */
    public function testBasicTest()
    {
        $this->withoutExceptionHandling();

        $this->assertTrue(true);
    }
}