我正在使用 dataprovider 并从数据库中获取数据:
public function logoProvider()
{
$result = Event::inRandomOrder()->select('id')->whereNotNull('logo')->first();
return [
[$result->id, '<path>'],
['', ''],
];
}
但出现以下错误:
The data provider specified for Tests\Unit\****Test::testLogo is invalid.
Error: Call to a member function connection() on null
有什么解决办法吗?
我有同样的问题并设法通过致电获得解决方法parent::setUp();
明确地位于数据提供者内部。
所以就你而言,
public function logoProvider()
{
parent::setUp();
$result = Event::inRandomOrder()->select('id')->whereNotNull('logo')->first();
return [
[$result->id, '<path>'],
['', ''],
];
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)