User management (#185)

This commit is contained in:
Saeed Vaziry
2024-04-29 20:58:04 +02:00
committed by GitHub
parent 35f896eab1
commit d846acaa8d
106 changed files with 1490 additions and 434 deletions

View File

@ -14,7 +14,7 @@ public function test_create_project(): void
{
$this->actingAs($this->user);
$this->post(route('projects.create'), [
$this->post(route('settings.projects.create'), [
'name' => 'test',
])->assertSessionDoesntHaveErrors();
@ -27,11 +27,11 @@ public function test_see_projects_list(): void
{
$this->actingAs($this->user);
$project = Project::factory()->create([
'user_id' => $this->user->id,
]);
$project = Project::factory()->create();
$this->get(route('projects'))
$this->user->projects()->attach($project);
$this->get(route('settings.projects'))
->assertSuccessful()
->assertSee($project->name);
}
@ -40,11 +40,11 @@ public function test_delete_project(): void
{
$this->actingAs($this->user);
$project = Project::factory()->create([
'user_id' => $this->user->id,
]);
$project = Project::factory()->create();
$this->delete(route('projects.delete', $project))
$this->user->projects()->attach($project);
$this->delete(route('settings.projects.delete', $project))
->assertSessionDoesntHaveErrors();
$this->assertDatabaseMissing('projects', [
@ -56,11 +56,11 @@ public function test_edit_project(): void
{
$this->actingAs($this->user);
$project = Project::factory()->create([
'user_id' => $this->user->id,
]);
$project = Project::factory()->create();
$this->post(route('projects.update', $project), [
$this->user->projects()->attach($project);
$this->post(route('settings.projects.update', $project), [
'name' => 'new-name',
])->assertSessionDoesntHaveErrors();
@ -74,7 +74,7 @@ public function test_cannot_delete_last_project(): void
{
$this->actingAs($this->user);
$this->delete(route('projects.delete', [
$this->delete(route('settings.projects.delete', [
'project' => $this->user->currentProject,
]))
->assertSessionDoesntHaveErrors()