Laravel phpunit "faking" 一个Request对象和一个Exception对象,可以吗?

Laravel phpunit "faking" a Request object and an Exception object, is it possible?

我为 Laravel 编写了一个包,其中包含一个需要两个参数的函数。第一个是包含 Content-Type 的 Request 实例,第二个是 Exception 实例(也可以是简单的字符串)。

如果请求的内容类型为 JSON,异常将被编码为 JSON。

我正在尝试使用 PHPUnit 测试程序包,但我不知道该怎么做。我想为此使用 Guzzle,但对于这样一个简单的测试来说似乎太过分了。

谁能建议我该怎么做?

来自the docs

You should not mock the Request facade. Instead, pass the input you desire into the HTTP helper methods such as get and post when running your test.