|
|
|
@ -4,6 +4,7 @@ use App\Entities\Payments\Payment; |
|
|
|
use App\Entities\Projects\Feature; |
|
|
|
use App\Entities\Projects\Project; |
|
|
|
use App\Entities\Projects\Task; |
|
|
|
use App\Entities\Users\Role; |
|
|
|
use App\Entities\Users\User; |
|
|
|
use Illuminate\Foundation\Testing\DatabaseMigrations; |
|
|
|
use Illuminate\Foundation\Testing\DatabaseTransactions; |
|
|
|
@ -11,11 +12,14 @@ use Illuminate\Foundation\Testing\WithoutMiddleware; |
|
|
|
|
|
|
|
class ManageProjectsTest extends TestCase |
|
|
|
{ |
|
|
|
use DatabaseTransactions; |
|
|
|
use DatabaseMigrations; |
|
|
|
|
|
|
|
/** @test */ |
|
|
|
public function admin_can_input_new_project_with_existing_customer() |
|
|
|
{ |
|
|
|
$adminRole = factory(Role::class)->create(['name' => 'admin']); |
|
|
|
$customerRole = factory(Role::class)->create(['name' => 'customer']); |
|
|
|
|
|
|
|
$users = factory(User::class, 2)->create(); |
|
|
|
$users[0]->assignRole('admin'); |
|
|
|
$this->actingAs($users[0]); |
|
|
|
@ -42,6 +46,7 @@ class ManageProjectsTest extends TestCase |
|
|
|
public function admin_can_input_new_project_with_new_customer() |
|
|
|
{ |
|
|
|
$this->adminUserSigningIn(); |
|
|
|
$customerRole = factory(Role::class)->create(['name' => 'customer']); |
|
|
|
|
|
|
|
$this->visit(route('projects.index')); |
|
|
|
$this->seePageIs(route('projects.index')); |
|
|
|
@ -107,6 +112,9 @@ class ManageProjectsTest extends TestCase |
|
|
|
/** @test */ |
|
|
|
public function admin_can_edit_a_project() |
|
|
|
{ |
|
|
|
$adminRole = factory(Role::class)->create(['name' => 'admin']); |
|
|
|
$customerRole = factory(Role::class)->create(['name' => 'customer']); |
|
|
|
|
|
|
|
$users = factory(User::class, 2)->create(); |
|
|
|
$users[0]->assignRole('admin'); |
|
|
|
$this->actingAs($users[0]); |
|
|
|
@ -142,6 +150,9 @@ class ManageProjectsTest extends TestCase |
|
|
|
/** @test */ |
|
|
|
public function form_is_validated_on_invalid_project_entry() |
|
|
|
{ |
|
|
|
$adminRole = factory(Role::class)->create(['name' => 'admin']); |
|
|
|
$customerRole = factory(Role::class)->create(['name' => 'customer']); |
|
|
|
|
|
|
|
$users = factory(User::class, 2)->create(); |
|
|
|
$users[0]->assignRole('admin'); |
|
|
|
$this->actingAs($users[0]); |
|
|
|
|