Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Laravel InvalidArgumentException:Action Facade\Ignition\Http\Controllers\ExecuteSolutionController未定义_Laravel_Laravel Dusk - Fatal编程技术网

Laravel InvalidArgumentException:Action Facade\Ignition\Http\Controllers\ExecuteSolutionController未定义

Laravel InvalidArgumentException:Action Facade\Ignition\Http\Controllers\ExecuteSolutionController未定义,laravel,laravel-dusk,Laravel,Laravel Dusk,我想做黄昏测试 ViewAnotherUsersTweetsTest.php /** * @test */ public function can_view_another_users_tweets() { $user = factory(User::class)->create(['username' => 'johndoe']); // make() stores in memory

我想做黄昏测试

ViewAnotherUsersTweetsTest.php

/**     
     * @test
     */
    public function can_view_another_users_tweets()
    {
        $user = factory(User::class)->create(['username' => 'johndoe']);

        // make() stores in memory
        $tweet = factory(Tweet::class)->make([           
            'body' => 'My first tweet'
        ]);


        $user->tweets()->save($tweet);

        $this->browse(function ($browser) {
            $browser->visit('/johndoe')
            ->dump();
        });        
    }
class UserController extends Controller
{
    public function show(string $username) {        
        $user = User::findByUsername($username); // ExecuteSolutionController not defined.
        dd($user);
   }
}
web.php中的路由:
Route::get({username},'UserController@show');

UserController.php

/**     
     * @test
     */
    public function can_view_another_users_tweets()
    {
        $user = factory(User::class)->create(['username' => 'johndoe']);

        // make() stores in memory
        $tweet = factory(Tweet::class)->make([           
            'body' => 'My first tweet'
        ]);


        $user->tweets()->save($tweet);

        $this->browse(function ($browser) {
            $browser->visit('/johndoe')
            ->dump();
        });        
    }
class UserController extends Controller
{
    public function show(string $username) {        
        $user = User::findByUsername($username); // ExecuteSolutionController not defined.
        dd($user);
   }
}
App\User.php
模型文件中

public static function findByUsername($username) {
 return self::where('username', $username)->first(); 
}
当我使用命令
php artisan dash--filter can\u view\u other\u users\u tweets
执行测试时,它失败并显示以下错误消息

(1/1)未定义InvalidArgumentException操作Facade\Ignition\Http\Controllers\ExecuteSolutionController。


原因可能是什么?如何修复它?

我们可以看到findByUsername函数吗?显然,您的代码在某些地方找不到ExecuteSolutionController。@mrhn用函数更新了问题