File: D:/HostingSpaces/MdnDirecteur/hours.komma.cloud/tests/Unit/UserTests.php
<?php
namespace Tests;
use App\User;
use Illuminate\Support\Facades\Session;
class UserTests extends TestCase
{
/**
* A basic test example.
*
* @return void
*/
public function testUnauthorizedAccess()
{
$response = $this->followingRedirects()->get('/');
$response->assertStatus(200);
$response->assertViewIs('auth.login');
}
public function testUserCanWiewLoginForm()
{
$response = $this->get('login');
$response->assertSuccessful();
$response->assertViewIs('auth.login');
}
public function testWrongLoginPost(){
$response = $this->followingRedirects()->get('/hours');
$response->assertStatus(200);
}
public function testCorrectLogin(){
Session::start();
$user = User::first();
$this->be($user);
$response = $this->get('/hours');
$response->assertStatus(200);
}
}