From 89a19006ad03ace24dcd73934fb714c68ea0d97f Mon Sep 17 00:00:00 2001 From: Sergio Brighenti Date: Sat, 3 Oct 2020 16:38:19 +0200 Subject: [PATCH] Added main login tests --- tests/Feature/LoginControllerTest.php | 10 +++++----- tests/config.test.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/Feature/LoginControllerTest.php b/tests/Feature/LoginControllerTest.php index 9b1e942..150eb10 100644 --- a/tests/Feature/LoginControllerTest.php +++ b/tests/Feature/LoginControllerTest.php @@ -75,6 +75,7 @@ class LoginControllerTest extends TestCase ->form([ 'username' => 'admin@example.com', 'password' => 'admin', + 'remember' => 'on', ], 'POST'); $this->submitForm($form); @@ -84,8 +85,9 @@ class LoginControllerTest extends TestCase } /** @test */ - public function it_set_the_remember_token() + public function it_redirects_to() { + $this->app->getContainer()->get('session')->set('redirectTo', route('profile')); $this->createAdminUser(); $response = $this->get(route('login.show')); @@ -97,9 +99,7 @@ class LoginControllerTest extends TestCase 'remember' => 'on', ], 'POST'); - $response = $this->submitForm($form); - dd($response->getHeaders()); - - + $redirect = $this->submitForm($form)->getHeaderLine('Location'); + $this->assertSame(route('profile'), $redirect); } } diff --git a/tests/config.test.php b/tests/config.test.php index bcec8b7..2978cae 100644 --- a/tests/config.test.php +++ b/tests/config.test.php @@ -1,7 +1,7 @@ 'http://localhost', + 'base_url' => 'http://localhost', 'debug' => true, 'db' => [