0

我正在尝试测试我的登录,但使用以下方法失败。为什么我无法登录用户有什么建议?

/** @test */
public function login_into_lerova()
{
    $user = factory(User::class)->create([
        'email' => 'max.mustermann@smartgate.ch',
        'password' => bcrypt('normal'),
    ]);

    $this->browse(function (Browser $browser) use ($user){

        $browser->visit(url(route('login')))
                ->type('email', $user->email)
                ->type('password','normal')
                ->press('@login-button')
                ->assertAuthenticatedAs($user);

    });
}

收到以下错误:

1) Tests\Browser\LoginTest::login_into_lerova
The currently authenticated user is not who was expected.
Failed asserting that Array &0 () is identical to Array &0 (
    'id' => 1
    'className' => 'App\User'
).

干杯, 斯坦

截图错误

4

1 回答 1

0

我建议你按照这个关于黄昏的教程,你会清楚你的问题是什么, Laravel Dusk 教程

于 2017-11-23T08:05:19.643 回答