Hallo i have this page test which is UserControllerTest. i tried to run PHP unit test in my laravel. i create this bellow
this is UserControllerTest
<?php
namespace TestsFeature;
use IlluminateFoundationTestingRefreshDatabase;
use IlluminateFoundationTestingWithFaker;
use TestsTestCase;
class UserControllerTest extends TestCase
{
public function testLoginPage() {
$this->get('/login')->assertSeeText('Login');
}
public function testLoginSuccess() {
$this->post("/login", [
"user" => "faisal",
"password" => "yagami"
])->assertRedirect("/")->assertSessionHas("user", "faisal");
}
public function testValidationError() {
$this->post("/login", [])->assertSeeText("User or Password is required");
}
public function testLoginFailed() {
$this->post('/login', [
"user" => "wrong",
"password" => "wrong"
])->assertSeeText("User or Password is wrong");
}
}