Browse Source

Added main login tests

Sergio Brighenti 4 years ago
parent
commit
89a19006ad
2 changed files with 6 additions and 6 deletions
  1. 5 5
      tests/Feature/LoginControllerTest.php
  2. 1 1
      tests/config.test.php

+ 5 - 5
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);
     }
 }

+ 1 - 1
tests/config.test.php

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