mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-06-06 20:37:32 +00:00
46 lines
988 B
PHP
46 lines
988 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class DeleteAccountTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_user_accounts_can_be_deleted(): void
|
|
{
|
|
// Arrange
|
|
$user = User::factory()->create();
|
|
$this->actingAs($user);
|
|
|
|
// Act
|
|
$response = $this->delete('/user', [
|
|
'password' => 'password',
|
|
]);
|
|
|
|
// Assert
|
|
$response->assertStatus(302);
|
|
$this->assertNull($user->fresh());
|
|
}
|
|
|
|
public function test_correct_password_must_be_provided_before_account_can_be_deleted(): void
|
|
{
|
|
// Arrange
|
|
$user = User::factory()->create();
|
|
$this->actingAs($user);
|
|
|
|
// Act
|
|
$response = $this->delete('/user', [
|
|
'password' => 'wrong-password',
|
|
]);
|
|
|
|
// Assert
|
|
$this->assertNotNull($user->fresh());
|
|
}
|
|
}
|