Added main login tests

This commit is contained in:
Sergio Brighenti 2020-10-03 16:38:19 +02:00
parent 125ae162ff
commit 89a19006ad
2 changed files with 6 additions and 6 deletions

View file

@ -75,6 +75,7 @@ class LoginControllerTest extends TestCase
->form([ ->form([
'username' => 'admin@example.com', 'username' => 'admin@example.com',
'password' => 'admin', 'password' => 'admin',
'remember' => 'on',
], 'POST'); ], 'POST');
$this->submitForm($form); $this->submitForm($form);
@ -84,8 +85,9 @@ class LoginControllerTest extends TestCase
} }
/** @test */ /** @test */
public function it_set_the_remember_token() public function it_redirects_to()
{ {
$this->app->getContainer()->get('session')->set('redirectTo', route('profile'));
$this->createAdminUser(); $this->createAdminUser();
$response = $this->get(route('login.show')); $response = $this->get(route('login.show'));
@ -97,9 +99,7 @@ class LoginControllerTest extends TestCase
'remember' => 'on', 'remember' => 'on',
], 'POST'); ], 'POST');
$response = $this->submitForm($form); $redirect = $this->submitForm($form)->getHeaderLine('Location');
dd($response->getHeaders()); $this->assertSame(route('profile'), $redirect);
} }
} }

View file

@ -1,7 +1,7 @@
<?php <?php
return [ return [
'base_path' => 'http://localhost', 'base_url' => 'http://localhost',
'debug' => true, 'debug' => true,
'db' => 'db' =>
[ [