Level 1
Hi @lockeyo ,
I do not understand why you set session for logged in user, maybe you have something I dont know.
In my case I don't set session I used
\Auth::loginUsingId($user_id);
Summer Sale! All accounts are 50% off this week.
Hello Laravel Community,
i really enjoy learning more about the Laravel Framework, but now i ran into something i can not figure out myself. I want to write a test for checking if a page of my WebApp returns the response code 200 (OK). To do this i need to set a cookie (Session-Cookie) with the information of the user. I had wrote some code, but it isn't working. If anybody has an idea it would be awesome to share the info with me.
class MainTest extends TestCase {
public function testUsersWithLoginProfilPage()
{
$this->session(['userrole' => '1']);
$this->session(['username' => 'marcel']);
$this->session(['userclass' => 'on13']);
$this->session(['vorname' => 'Marcel']);
$this->session(['nachname' => 'Example']);
$this->session(['email' => 'marcel@example.com']);
$response = $this->call('GET', 'users');
$this->assertResponseOk();
}
}
Greetings form Germany,
Marcel
Please or to participate in this conversation.