Advertisement
Guest User

Untitled

a guest
Apr 26th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Tests\Feature;
  4.  
  5. use Tests\TestCase;
  6. use Illuminate\Foundation\Testing\WithFaker;
  7. use Illuminate\Foundation\Testing\RefreshDatabase;
  8. use App\User;
  9.  
  10. class TestAuthentication extends TestCase
  11. {
  12.     use RefreshDatabase;
  13.  
  14.     public $testUser = [
  15.         'name' => 'tester engineering',
  16.         'email' => 'test@cmu.ac.th'
  17.     ];
  18.  
  19.     public function setUp()
  20.     {  
  21.         parent::setUp();
  22.  
  23.         $this->artisan("db:seed");
  24.         User::create($this->testUser);
  25.     }
  26.  
  27.     public function authenticated()
  28.     {
  29.         $user = User::where('email', $this->testUser['email'])->first();
  30.  
  31.         return $this->actingAs($user);
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement