From 71e6910a21db1bb61d7458b0e2ddbad18eab5f3d Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Tue, 9 Aug 2016 20:33:18 +0800 Subject: [PATCH] Refactor ManageProjectsTest --- .../features/partials/feature-tasks-operation.blade.php | 2 +- tests/ManageProjectsTest.php | 12 +++--------- tests/TestCase.php | 11 +++++++++++ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/resources/views/features/partials/feature-tasks-operation.blade.php b/resources/views/features/partials/feature-tasks-operation.blade.php index 83440d7..5d2c736 100644 --- a/resources/views/features/partials/feature-tasks-operation.blade.php +++ b/resources/views/features/partials/feature-tasks-operation.blade.php @@ -24,7 +24,7 @@
{!! FormField::text('route_name') !!}
{!! FormField::text('progress', ['addon' => ['after' => '%']]) !!}
- {!! FormField::text('description') !!} + {!! FormField::textarea('description') !!} {!! Form::hidden('feature_id', $editableTask->feature_id) !!} {!! Form::submit(trans('task.update'), ['class' => 'btn btn-warning']) !!} {!! link_to_route('features.show', trans('app.cancel'), [$feature->id], ['class' => 'btn btn-default']) !!} diff --git a/tests/ManageProjectsTest.php b/tests/ManageProjectsTest.php index 1dd5f0d..2463747 100644 --- a/tests/ManageProjectsTest.php +++ b/tests/ManageProjectsTest.php @@ -41,9 +41,7 @@ class ManageProjectsTest extends TestCase /** @test */ public function admin_can_input_new_project_with_new_customer() { - $user = factory(User::class)->create(); - $user->assignRole('admin'); - $this->actingAs($user); + $this->adminUserSigningIn(); $this->visit(route('projects.index')); $this->seePageIs(route('projects.index')); @@ -73,9 +71,7 @@ class ManageProjectsTest extends TestCase /** @test */ public function admin_can_delete_a_project() { - $user = factory(User::class)->create(); - $user->assignRole('admin'); - $this->actingAs($user); + $this->adminUserSigningIn(); $project = factory(Project::class)->create(['owner_id' => $user->id]); $feature = factory(Feature::class)->create(['project_id' => $project->id]); @@ -169,9 +165,7 @@ class ManageProjectsTest extends TestCase /** @test */ public function admin_can_update_project_status_on_project_detail_page() { - $user = factory(User::class)->create(); - $user->assignRole('admin'); - $this->actingAs($user); + $this->adminUserSigningIn(); $project = factory(Project::class)->create(['owner_id' => $user->id, 'status_id' => 1]); $this->visit(route('projects.show', $project->id)); diff --git a/tests/TestCase.php b/tests/TestCase.php index 8578b17..7f01900 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -1,5 +1,7 @@ create(); + $user->assignRole('admin'); + $this->actingAs($user); + + return $user; + } }