3
クッキーの存在に基づいて特定の動作をテストする必要があります。要求を送信する前にクッキーを設定するにはどうすればよいですか?次の段階で失敗すると、何も設定されていないのが好きです。Laravelでテスト前にクッキーを設定する方法は?
$this->actingAs($user)
->withSession(['user' => $user, 'profile' => $profile]) ;
@setcookie('locale_lc', "fr", time() + 60 * 60 * 24 * 900, '/', "domain.com", true, true) ;
$this->visit('/profile') ;
それとも
$cookie = ['locale_lc' => Crypt::encrypt('fr')] ;
$this->actingAs($user)
->withSession(['user' => $user, 'profile' => $profile])
->makeRequest('GET', '/profile', [], $cookie) ;
暗号化を無効にしていない場合でもこれは動作しますか? – Flimm