Laravel望远镜不会记录来自TestCase的请求
出于调试目的,我想让望远镜记录来自测试套件的任何请求。望远镜目前没有,我也不知道为什么 我在Laravel望远镜不会记录来自TestCase的请求,laravel,laravel-testing,Laravel,Laravel Testing,出于调试目的,我想让望远镜记录来自测试套件的任何请求。望远镜目前没有,我也不知道为什么 我在phpunit.xml <env name="TELESCOPE_ENABLED" value="true"/> 当我打开望远镜时,没有保存/api/vehicle的条目。我需要始终强制望远镜在望远镜服务提供商中记录 class TelescopeServiceProvider extends TelescopeApplicationServiceProvider { /**
phpunit.xml
<env name="TELESCOPE_ENABLED" value="true"/>
当我打开望远镜时,没有保存
/api/vehicle
的条目。我需要始终强制望远镜在望远镜服务提供商中记录
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();
});
}
由于望远镜前端链接到
开发数据库
,在测试
期间记录的望远镜条目保存在测试数据库
中,这解释了我何时刷新望远镜前端(使用开发数据库
),没有显示任何内容。也许这就是您要查找的内容?该链接告诉我如何在构建和测试环境中不包含望远镜。默认情况下,望远镜可以在任何环境下工作,我现在就站在这里。你们在生产吗?也许这有帮助?
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();
});
}