为了调试的目的,我想让望远镜记录任何来自测试套件的请求。望远镜目前没有,我也不知道为什么。
我在phpunit.xml中启用了望远镜
<env name="TELESCOPE_ENABLED" value="true"/>这是我的功能测试
$this->getJson('/api/vehicle')->assertStatus(401);当我打开望远镜时,没有保存/api/vehicle的条目。
发布于 2019-05-16 23:34:58
我需要始终强制望远镜在TelescopeServiceProvider中记录
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
// Telescope::night();
Telescope::filter(function (IncomingEntry $entry) {
if ($this->app->environment('local')) {
return true;
}
if ($this->app->environment('testing')) {
return true;
}
return $entry->isReportableException() ||
$entry->isFailedJob() ||
$entry->isScheduledTask() ||
$entry->hasMonitoredTag();
});
}由于望远镜前端链接到development-database,所以在testing期间记录的望远镜条目保存在testing-database中,这解释了当我刷新望远镜前端(使用development-database)时,没有显示任何内容。
https://stackoverflow.com/questions/56159020
复制相似问题