This commit is contained in:
Saeed Vaziry
2024-03-24 09:56:34 +01:00
committed by GitHub
parent 884f18db63
commit 4d051330d6
1055 changed files with 14493 additions and 20278 deletions

View File

@ -37,4 +37,11 @@ public function test_users_can_not_authenticate_with_invalid_password(): void
$this->assertGuest();
}
public function test_redirect_if_not_authenticated(): void
{
$response = $this->get('/servers');
$response->assertRedirect('/login');
}
}

View File

@ -3,7 +3,6 @@
namespace Tests\Feature\Auth;
use Illuminate\Foundation\Testing\RefreshDatabase;
use JsonException;
use Tests\TestCase;
class PasswordConfirmationTest extends TestCase
@ -19,9 +18,6 @@ public function test_confirm_password_screen_can_be_rendered(): void
$response->assertStatus(200);
}
/**
* @throws JsonException
*/
public function test_password_can_be_confirmed(): void
{
$this->actingAs($this->user);
@ -31,7 +27,7 @@ public function test_password_can_be_confirmed(): void
]);
$response->assertRedirect();
$response->assertSessionHasNoErrors();
$response->assertSessionDoesntHaveErrors();
}
public function test_password_is_not_confirmed_with_invalid_password(): void

View File

@ -56,7 +56,7 @@ public function test_password_can_be_reset_with_valid_token(): void
'password_confirmation' => 'password',
]);
$response->assertSessionHasNoErrors();
$response->assertSessionDoesntHaveErrors();
return true;
});

View File

@ -1,40 +0,0 @@
<?php
namespace Tests\Feature\Auth;
use App\Http\Livewire\Profile\UpdatePassword;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Hash;
use Livewire\Livewire;
use Tests\TestCase;
class PasswordUpdateTest extends TestCase
{
use RefreshDatabase;
public function test_password_can_be_updated(): void
{
$this->actingAs($this->user);
Livewire::test(UpdatePassword::class)
->set('current_password', 'password')
->set('password', 'new-password')
->set('password_confirmation', 'new-password')
->call('update')
->assertSuccessful();
$this->assertTrue(Hash::check('new-password', $this->user->refresh()->password));
}
public function test_correct_password_must_be_provided_to_update_password(): void
{
$this->actingAs($this->user);
Livewire::test(UpdatePassword::class)
->set('current_password', 'wrong-password')
->set('password', 'new-password')
->set('password_confirmation', 'new-password')
->call('update')
->assertHasErrors();
}
}