我正在尝试为我的Laravel 包添加刀片指令。
一切都很好,但在测试阶段,我收到了这个错误:
1) MahbodHastam\UserWallet\Tests\Feature\BladeTest::show_user_wallet_balance
InvalidArgumentException: View [userWalletBalance] not found.
我应该输入$this->loadViewsFrom(...)
服务提供商吗?
查看路径:/tests/resources/views/userWalletBalance.blade.php
测试路径:/tests/Feature/BladeTest.php
我还尝试将resources
目录移动到Feature
目录中(在 旁边BladeTest.php
),但遇到了同样的错误。
这是我的代码BladeTest.php
:
public function show_user_wallet_balance() {
$wallet = UserWallet::getWallet(wallet_id: 1);
$this->assertEquals('1000', $this->renderView('userWalletBalance', ['wallet' => $wallet]));
}
protected function renderView($view, $with) {
Artisan::call('view:clear');
return trim((string) view($view)->with($with));
}