Skip to content

Commit

Permalink
update all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bosun18 committed Feb 2, 2024
1 parent 373bcaf commit 4ad3859
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 40 deletions.
3 changes: 0 additions & 3 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
colors="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
Expand Down
12 changes: 6 additions & 6 deletions tests/Feature/LabelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ public function testCreate(): void

public function testStore(): void
{
$this->name = Label::factory()->make()->name;
$name = Label::factory()->make()->name;
$response = $this
->actingAs($this->user)
->post(route('labels.store'), [
'name' => $this->name
'name' => $name
]);

$response->assertSessionHasNoErrors();
$this->assertDatabaseHas('labels', ['name' => $this->name]);
$this->assertDatabaseHas('labels', ['name' => $name]);
$response->assertRedirect(route('labels.index'));
}

Expand All @@ -59,15 +59,15 @@ public function testEdit(): void

public function testUpdate(): void
{
$this->nameUpdate = Label::factory()->make()->name;
$nameUpdate = Label::factory()->make()->name;
$response = $this
->actingAs($this->user)
->patch(route('labels.update', ['label' => $this->label]), [
'name' => $this->nameUpdate
'name' => $nameUpdate
]);

$response->assertSessionHasNoErrors();
$this->assertDatabaseHas('labels', ['name' => $this->nameUpdate]);
$this->assertDatabaseHas('labels', ['name' => $nameUpdate]);
$response->assertRedirect(route('labels.index'));
}

Expand Down
12 changes: 6 additions & 6 deletions tests/Feature/TaskStatusTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ public function testCreate(): void

public function testStore(): void
{
$this->name = TaskStatus::factory()->make()->name;
$name = TaskStatus::factory()->make()->name;
$response = $this
->actingAs($this->user)
->post(route('task_statuses.store'), [
'name' => $this->name
'name' => $name
]);

$response->assertSessionHasNoErrors();
$this->assertDatabaseHas('task_statuses', ['name' => $this->name]);
$this->assertDatabaseHas('task_statuses', ['name' => $name]);
$response->assertRedirect(route('task_statuses.index'));
}

Expand All @@ -59,15 +59,15 @@ public function testEdit(): void

public function testUpdate(): void
{
$this->nameUpdate = TaskStatus::factory()->make()->name;
$nameUpdate = TaskStatus::factory()->make()->name;
$response = $this
->actingAs($this->user)
->patch(route('task_statuses.update', ['task_status' => $this->taskStatus]), [
'name' => $this->nameUpdate
'name' => $nameUpdate
]);

$response->assertSessionHasNoErrors();
$this->assertDatabaseHas('task_statuses', ['name' => $this->nameUpdate]);
$this->assertDatabaseHas('task_statuses', ['name' => $nameUpdate]);
$response->assertRedirect(route('task_statuses.index'));
}

Expand Down
12 changes: 6 additions & 6 deletions tests/Feature/TaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,18 @@ public function testCreate(): void
*/
public function testStore(): void
{
$this->newTaskData = Task::factory()->make()->only([
$newTaskData = Task::factory()->make()->only([
'name',
'description',
'status_id',
'assigned_to_id',
]);
$response = $this
->actingAs($this->user)
->post(route('tasks.store'), $this->newTaskData);
->post(route('tasks.store'), $newTaskData);

$response->assertSessionHasNoErrors();
$this->assertDatabaseHas('tasks', $this->newTaskData);
$this->assertDatabaseHas('tasks', $newTaskData);
$response->assertRedirect(route('tasks.index'));
}

Expand All @@ -76,18 +76,18 @@ public function testEdit(): void
*/
public function testUpdate(): void
{
$this->taskDataForUpdate = Task::factory()->make()->only([
$taskDataForUpdate = Task::factory()->make()->only([
'name',
'description',
'status_id',
'assigned_to_id',
]);
$response = $this
->actingAs($this->user)
->patch(route('tasks.update', ['task' => $this->task]), $this->taskDataForUpdate);
->patch(route('tasks.update', ['task' => $this->task]), $taskDataForUpdate);

$response->assertSessionHasNoErrors();
$this->assertDatabaseHas('tasks', $this->taskDataForUpdate);
$this->assertDatabaseHas('tasks', $taskDataForUpdate);
$response->assertRedirect(route('tasks.index'));
}

Expand Down
19 changes: 0 additions & 19 deletions tests/Unit/ExampleTest.php

This file was deleted.

0 comments on commit 4ad3859

Please sign in to comment.