|
|
|
@ -3,7 +3,6 @@ |
|
|
|
namespace Tests\Feature; |
|
|
|
|
|
|
|
use App\Entities\Projects\Feature; |
|
|
|
use App\Entities\Projects\Project; |
|
|
|
use App\Entities\Projects\Task; |
|
|
|
use Tests\TestCase; |
|
|
|
|
|
|
|
@ -13,25 +12,26 @@ class ManageTasksTest extends TestCase |
|
|
|
public function admin_can_entry_task() |
|
|
|
{ |
|
|
|
$user = $this->adminUserSigningIn(); |
|
|
|
$project = factory(Project::class)->create(); |
|
|
|
$feature = factory(Feature::class)->create(['worker_id' => $user->id]); |
|
|
|
|
|
|
|
$feature = factory(Feature::class)->create(['worker_id' => $user->id, 'project_id' => $project->id]); |
|
|
|
$this->visit('features/'.$feature->id); |
|
|
|
$this->seePageIs('features/'.$feature->id); |
|
|
|
$this->visit(route('features.show', $feature->id)); |
|
|
|
$this->seePageIs(route('features.show', $feature->id)); |
|
|
|
$this->see(trans('feature.tasks')); |
|
|
|
$this->see(trans('task.create')); |
|
|
|
|
|
|
|
// Fill Form
|
|
|
|
$this->type('Nama Task Baru', 'name'); |
|
|
|
$this->type('Ipsam magnam laboriosam distinctio officia facere sapiente eius corporis', 'description'); |
|
|
|
$this->type(70, 'progress'); |
|
|
|
$this->type('tasks/create', 'route_name'); |
|
|
|
$this->press(trans('task.create')); |
|
|
|
$this->submitForm(trans('task.create'), [ |
|
|
|
'name' => 'Nama Task Baru', |
|
|
|
'description' => 'Deskripsi task yang dikerjakani.', |
|
|
|
'progress' => 70, |
|
|
|
'route_name' => 'tasks/create', |
|
|
|
]); |
|
|
|
|
|
|
|
$this->seePageIs('features/'.$feature->id); |
|
|
|
$this->seePageIs(route('features.show', $feature->id)); |
|
|
|
$this->see(trans('task.created')); |
|
|
|
|
|
|
|
$this->seeInDatabase('tasks', [ |
|
|
|
'name' => 'Nama Task Baru', |
|
|
|
'description' => 'Deskripsi task yang dikerjakani.', |
|
|
|
'progress' => 70, |
|
|
|
'feature_id' => $feature->id, |
|
|
|
'route_name' => 'tasks/create', |
|
|
|
@ -42,25 +42,23 @@ class ManageTasksTest extends TestCase |
|
|
|
public function admin_can_edit_task_data() |
|
|
|
{ |
|
|
|
$user = $this->adminUserSigningIn(); |
|
|
|
$project = factory(Project::class)->create(); |
|
|
|
|
|
|
|
$feature = factory(Feature::class)->create(['worker_id' => $user->id, 'project_id' => $project->id]); |
|
|
|
|
|
|
|
$feature = factory(Feature::class)->create(['worker_id' => $user->id]); |
|
|
|
$task = factory(Task::class)->create(['feature_id' => $feature->id]); |
|
|
|
|
|
|
|
$this->visit('features/'.$feature->id); |
|
|
|
$this->visit(route('features.show', $feature->id)); |
|
|
|
$this->click($task->id.'-tasks-edit'); |
|
|
|
$this->seePageIs('features/'.$feature->id.'?action=task_edit&task_id='.$task->id); |
|
|
|
$this->seePageIs(route('features.show', [$feature->id, 'action' => 'task_edit', 'task_id' => $task->id])); |
|
|
|
$this->see(trans('task.edit')); |
|
|
|
$this->see(trans('task.update')); |
|
|
|
|
|
|
|
// Fill Form
|
|
|
|
$this->type('Nama Task Edit', 'name'); |
|
|
|
$this->type(77, 'progress'); |
|
|
|
$this->press(trans('task.update')); |
|
|
|
$this->submitForm(trans('task.update'), [ |
|
|
|
'name' => 'Nama Task Edit', |
|
|
|
'progress' => 77, |
|
|
|
]); |
|
|
|
|
|
|
|
$this->seePageIs('features/'.$feature->id); |
|
|
|
$this->seePageIs(route('features.show', $feature->id)); |
|
|
|
$this->see(trans('task.updated')); |
|
|
|
|
|
|
|
$this->seeInDatabase('tasks', [ |
|
|
|
'name' => 'Nama Task Edit', |
|
|
|
'progress' => 77, |
|
|
|
@ -72,17 +70,15 @@ class ManageTasksTest extends TestCase |
|
|
|
public function admin_can_delete_a_task() |
|
|
|
{ |
|
|
|
$user = $this->adminUserSigningIn(); |
|
|
|
$project = factory(Project::class)->create(); |
|
|
|
|
|
|
|
$feature = factory(Feature::class)->create(['worker_id' => $user->id, 'project_id' => $project->id]); |
|
|
|
|
|
|
|
$feature = factory(Feature::class)->create(['worker_id' => $user->id]); |
|
|
|
$task = factory(Task::class)->create(['feature_id' => $feature->id]); |
|
|
|
|
|
|
|
$this->visit('features/'.$feature->id); |
|
|
|
$this->visit(route('features.show', $feature->id)); |
|
|
|
$this->click($task->id.'-tasks-delete'); |
|
|
|
$this->see(trans('app.delete_confirm_button')); |
|
|
|
$this->press(trans('app.delete_confirm_button')); |
|
|
|
$this->seePageIs('features/'.$feature->id); |
|
|
|
|
|
|
|
$this->seePageIs(route('features.show', $feature->id)); |
|
|
|
$this->see(trans('task.deleted')); |
|
|
|
} |
|
|
|
} |