Browse Source

PSR 2 format on test classes

pull/1/head
Nafies Luthfi 8 years ago
parent
commit
f59f644483
  1. 10
      tests/Feature/Api/ApiEventsTest.php
  2. 2
      tests/Feature/Api/ApiManageProjectsTest.php
  3. 16
      tests/Feature/Auth/MemberChangePasswordTest.php
  4. 8
      tests/Feature/Auth/MemberLoginTest.php
  5. 1
      tests/Feature/Auth/MemberRegistrationTest.php
  6. 4
      tests/Feature/Auth/ResetPasswordTest.php
  7. 81
      tests/Feature/ManageFeaturesTest.php
  8. 64
      tests/Feature/ManageProjectsTest.php
  9. 36
      tests/Feature/ManageSubscriptionsTest.php
  10. 35
      tests/Feature/ManageTasksTest.php
  11. 10
      tests/Feature/ManageUsersTest.php
  12. 34
      tests/Feature/Payments/ManagePaymentsTest.php
  13. 3
      tests/Feature/Payments/PaymentSearchTest.php
  14. 4
      tests/Feature/Projects/UploadFilesTest.php
  15. 2
      tests/TestCase.php
  16. 29
      tests/Unit/Models/ProjectTest.php

10
tests/Feature/Api/ApiEventsTest.php

@ -16,7 +16,7 @@ class ApiEventsTest extends TestCase
$events = factory(Event::class, 2)->create(['user_id' => $user->id]);
$this->getJson(route('api.events.index'), [
'Authorization' => 'Bearer ' . $user->api_token
'Authorization' => 'Bearer '.$user->api_token
]);
$this->seeStatusCode(200);
@ -46,7 +46,7 @@ class ApiEventsTest extends TestCase
'start' => '2016-07-21 12:20:00',
'project_id' => $project->id,
], [
'Authorization' => 'Bearer ' . $user->api_token
'Authorization' => 'Bearer '.$user->api_token
]);
// $this->dump();
@ -89,7 +89,7 @@ class ApiEventsTest extends TestCase
'body' => 'New Event Body',
'is_allday' => 'true',
], [
'Authorization' => 'Bearer ' . $user->api_token
'Authorization' => 'Bearer '.$user->api_token
]);
$this->seeStatusCode(200);
@ -117,7 +117,7 @@ class ApiEventsTest extends TestCase
$event = factory(Event::class)->create(['user_id' => $user->id]);
$this->deleteJson(route('api.events.destroy'), ['id' => $event->id], [
'Authorization' => 'Bearer ' . $user->api_token
'Authorization' => 'Bearer '.$user->api_token
]);
$this->seeStatusCode(200);
@ -138,7 +138,7 @@ class ApiEventsTest extends TestCase
'start' => '2016-11-07 13:00:00',
'end' => '2016-11-07 15:00:00',
], [
'Authorization' => 'Bearer ' . $user->api_token
'Authorization' => 'Bearer '.$user->api_token
]);
// $this->dump();

2
tests/Feature/Api/ApiManageProjectsTest.php

@ -15,7 +15,7 @@ class ApiManageProjectsTest extends TestCase
$project = factory(Project::class, 5)->create(['owner_id' => $user->id]);
$this->getJson(route('api.projects.index'), [
'Authorization' => 'Bearer ' . $user->api_token
'Authorization' => 'Bearer '.$user->api_token
]);
$this->seeStatusCode(200);

16
tests/Feature/Auth/MemberChangePasswordTest.php

@ -18,23 +18,23 @@ class MemberChangePasswordTest extends TestCase
$this->seePageIs(route('home'));
$this->click(trans('auth.change_password'));
$this->type('member1','old_password');
$this->type('rahasia','password');
$this->type('rahasia','password_confirmation');
$this->type('member1', 'old_password');
$this->type('rahasia', 'password');
$this->type('rahasia', 'password_confirmation');
$this->press(trans('auth.change_password'));
$this->see('Password lama tidak cocok');
$this->type('member','old_password');
$this->type('rahasia','password');
$this->type('rahasia','password_confirmation');
$this->type('member', 'old_password');
$this->type('rahasia', 'password');
$this->type('rahasia', 'password_confirmation');
$this->press(trans('auth.change_password'));
$this->see('Password berhasil diubah');
// Logout and login using new Password
$this->click('Keluar');
$this->seePageIs(route('auth.login'));
$this->type($user->email,'email');
$this->type('rahasia','password');
$this->type($user->email, 'email');
$this->type('rahasia', 'password');
$this->press('Login');
$this->seePageIs(route('home'));
}

8
tests/Feature/Auth/MemberLoginTest.php

@ -14,8 +14,8 @@ class MemberLoginTest extends TestCase
$user->assignRole('customer');
$this->visit(route('auth.login'));
$this->type('email@mail.com','email');
$this->type('member','password');
$this->type('email@mail.com', 'email');
$this->type('member', 'password');
$this->press(trans('auth.login'));
$this->seePageIs(route('home'));
$this->see('Selamat datang kembali Nama Member.');
@ -28,8 +28,8 @@ class MemberLoginTest extends TestCase
public function member_invalid_login()
{
$this->visit(route('auth.login'));
$this->type('email@mail.com','email');
$this->type('password.112','password');
$this->type('email@mail.com', 'email');
$this->type('password.112', 'password');
$this->press(trans('auth.login'));
$this->seePageIs(route('auth.login'));
$this->see('Mohon maaf, anda tidak dapat login');

1
tests/Feature/Auth/MemberRegistrationTest.php

@ -2,7 +2,6 @@
namespace Tests\Feature\Auth;
use App\Entities\Users\User;
use Tests\TestCase;
class MemberRegistrationTest extends TestCase

4
tests/Feature/Auth/ResetPasswordTest.php

@ -19,14 +19,12 @@ class ResetPasswordTest extends TestCase
'email' => 'testing@app.dev'
]);
$this->see(trans('auth.reset_password'));
$this->type('testing@app.dev','email');
$this->type('testing@app.dev', 'email');
$this->press(trans('auth.send_reset_password_link'));
$this->seePageIs('password/reset');
$this->see(trans('passwords.sent'));
$this->seeInDatabase('password_resets', [
'email' => 'testing@app.dev'
]);
}
}

81
tests/Feature/ManageFeaturesTest.php

@ -22,18 +22,18 @@ class ManageFeaturesTest extends TestCase
$worker = factory(User::class)->create();
$worker->assignRole('worker');
$this->visit('projects/' . $project->id . '/features');
$this->seePageIs('projects/' . $project->id . '/features');
$this->visit('projects/'.$project->id.'/features');
$this->seePageIs('projects/'.$project->id.'/features');
$this->see(trans('project.features'));
$this->click(trans('feature.create'));
$this->seePageIs('projects/' . $project->id . '/features/create');
$this->seePageIs('projects/'.$project->id.'/features/create');
// Fill Form
$this->type('Nama Fitur Baru','name');
$this->type(100000,'price');
$this->type('Nama Fitur Baru', 'name');
$this->type(100000, 'price');
$this->select($worker->id, 'worker_id');
$this->select(1, 'type_id');
$this->type('Similique, eligendi fuga animi? Ipsam magnam laboriosam distinctio officia facere sapiente eius corporis','description');
$this->type('Similique, eligendi fuga animi? Ipsam magnam laboriosam distinctio officia facere sapiente eius corporis', 'description');
$this->press(trans('feature.create'));
$this->see(trans('feature.created'));
@ -59,17 +59,17 @@ class ManageFeaturesTest extends TestCase
$feature = factory(Feature::class)->create(['worker_id' => $user[1]->id, 'project_id' => $project->id]);
$this->visit('features/' . $feature->id . '/edit');
$this->seePageIs('features/' . $feature->id . '/edit');
$this->visit('features/'.$feature->id.'/edit');
$this->seePageIs('features/'.$feature->id.'/edit');
// Fill Form
$this->type('Nama Fitur Edit','name');
$this->type(33333,'price');
$this->select($user[2]->id,'worker_id');
$this->type('Nama Fitur Edit', 'name');
$this->type(33333, 'price');
$this->select($user[2]->id, 'worker_id');
$this->select(2, 'type_id');
$this->press(trans('feature.update'));
$this->seePageIs('features/' . $feature->id);
$this->seePageIs('features/'.$feature->id);
$this->see(trans('feature.updated'));
$this->seeInDatabase('features', [
'name' => 'Nama Fitur Edit',
@ -97,17 +97,17 @@ class ManageFeaturesTest extends TestCase
'project_id' => $project->id,
]);
// $this->visit('projects/' . $project->id . '/features');
// $this->seePageIs('projects/' . $project->id . '/features');
// $this->click('show-feature-' . $feature->id);
// $this->visit('projects/'.$project->id.'/features');
// $this->seePageIs('projects/'.$project->id.'/features');
// $this->click('show-feature-'.$feature->id);
// $this->dump();
$this->visit('features/' . $feature->id);
$this->seePageIs('features/' . $feature->id);
$this->visit('features/'.$feature->id);
$this->seePageIs('features/'.$feature->id);
// die('hit');
$this->click(trans('app.edit'));
$this->click(trans('feature.delete'));
$this->press(trans('app.delete_confirm_button'));
$this->seePageIs('projects/' . $project->id . '/features');
$this->seePageIs('projects/'.$project->id.'/features');
$this->see(trans('feature.deleted'));
$this->notSeeInDatabase('features', [
@ -131,9 +131,9 @@ class ManageFeaturesTest extends TestCase
$project = factory(Project::class)->create(['owner_id' => $user->id]);
$feature = factory(Feature::class)->create(['project_id' => $project->id,'type_id' => 1]);
$this->visit('projects/' . $project->id . '/features');
$this->click('show-feature-' . $feature->id);
$this->seePageIs('features/' . $feature->id);
$this->visit('projects/'.$project->id.'/features');
$this->click('show-feature-'.$feature->id);
$this->seePageIs('features/'.$feature->id);
$this->see(trans('feature.show'));
$this->see($feature->name);
$this->see(formatRp($feature->price));
@ -152,42 +152,42 @@ class ManageFeaturesTest extends TestCase
$tasks1 = factory(Task::class, 3)->create(['feature_id' => $features[0]->id]);
$tasks2 = factory(Task::class, 3)->create(['feature_id' => $features[1]->id]);
$this->visit('projects/' . $projects[1]->id . '/features');
$this->seePageIs('projects/' . $projects[1]->id . '/features');
$this->visit('projects/'.$projects[1]->id.'/features');
$this->seePageIs('projects/'.$projects[1]->id.'/features');
$this->click(trans('feature.add_from_other_project'));
$this->seePageIs('projects/' . $projects[1]->id . '/features/add-from-other-project');
$this->seePageIs('projects/'.$projects[1]->id.'/features/add-from-other-project');
$this->select($projects[0]->id, 'project_id');
$this->press('Lihat Fitur');
$this->seePageIs('projects/' . $projects[1]->id . '/features/add-from-other-project?project_id=' . $projects[0]->id);
$this->seePageIs('projects/'.$projects[1]->id.'/features/add-from-other-project?project_id='.$projects[0]->id);
// $this->submitForm(trans('feature.create'), [
// 'feature_ids' => [$features[0]->id,$features[1]->id],
// $features[0]->id . '_task_ids' => [$tasks1[0]->id,$tasks1[1]->id,$tasks1[2]->id],
// $features[1]->id . '_task_ids' => [$tasks2[0]->id,$tasks2[1]->id,$tasks2[2]->id],
// $features[0]->id.'_task_ids' => [$tasks1[0]->id,$tasks1[1]->id,$tasks1[2]->id],
// $features[1]->id.'_task_ids' => [$tasks2[0]->id,$tasks2[1]->id,$tasks2[2]->id],
// ]);
// $this->check('feature_ids[0]');
// $this->check('feature_ids[1]');
// $this->check($features[0]->id . '_task_ids[0]');
// $this->check($features[0]->id . '_task_ids[1]');
// $this->check($features[0]->id . '_task_ids[2]');
// $this->check($features[1]->id . '_task_ids[0]');
// $this->check($features[1]->id . '_task_ids[1]');
// $this->check($features[1]->id . '_task_ids[2]');
// $this->check($features[0]->id.'_task_ids[0]');
// $this->check($features[0]->id.'_task_ids[1]');
// $this->check($features[0]->id.'_task_ids[2]');
// $this->check($features[1]->id.'_task_ids[0]');
// $this->check($features[1]->id.'_task_ids[1]');
// $this->check($features[1]->id.'_task_ids[2]');
// $this->press(trans('feature.create'));
$form = $this->getForm(trans('feature.create'));
$form['feature_ids'][$features[0]->id]->tick();
$form['feature_ids'][$features[1]->id]->tick();
$form[$features[0]->id . '_task_ids'][$tasks1[0]->id]->tick();
$form[$features[0]->id . '_task_ids'][$tasks1[1]->id]->tick();
$form[$features[0]->id . '_task_ids'][$tasks1[2]->id]->tick();
$form[$features[1]->id . '_task_ids'][$tasks2[0]->id]->tick();
$form[$features[1]->id . '_task_ids'][$tasks2[1]->id]->tick();
$form[$features[1]->id . '_task_ids'][$tasks2[2]->id]->tick();
$form[$features[0]->id.'_task_ids'][$tasks1[0]->id]->tick();
$form[$features[0]->id.'_task_ids'][$tasks1[1]->id]->tick();
$form[$features[0]->id.'_task_ids'][$tasks1[2]->id]->tick();
$form[$features[1]->id.'_task_ids'][$tasks2[0]->id]->tick();
$form[$features[1]->id.'_task_ids'][$tasks2[1]->id]->tick();
$form[$features[1]->id.'_task_ids'][$tasks2[2]->id]->tick();
$this->makeRequestUsingForm($form);
$this->seePageIs('projects/' . $projects[1]->id . '/features');
$this->seePageIs('projects/'.$projects[1]->id.'/features');
$this->see(trans('feature.created_from_other_project'));
$this->seeInDatabase('features', [
'project_id' => $projects[1]->id,
@ -222,6 +222,5 @@ class ManageFeaturesTest extends TestCase
$this->visit('features');
$this->seePageIs('features');
}
}

64
tests/Feature/ManageProjectsTest.php

@ -6,7 +6,6 @@ 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 Tests\TestCase;
@ -25,11 +24,11 @@ class ManageProjectsTest extends TestCase
$this->seePageIs(route('projects.index'));
$this->click(trans('project.create'));
$this->seePageIs(route('projects.create'));
$this->type('Project Baru','name');
$this->select($users[1]->id,'customer_id');
$this->type('2016-04-15','proposal_date');
$this->type('2000000','proposal_value');
$this->type('Deskripsi project baru','description');
$this->type('Project Baru', 'name');
$this->select($users[1]->id, 'customer_id');
$this->type('2016-04-15', 'proposal_date');
$this->type('2000000', 'proposal_value');
$this->type('Deskripsi project baru', 'description');
$this->press(trans('project.create'));
$this->see(trans('project.created'));
@ -48,17 +47,17 @@ class ManageProjectsTest extends TestCase
$this->seePageIs(route('projects.create'));
// Invalid entry
$this->type('Project Baru','name');
$this->select('','customer_id');
$this->type('2016-04-15','proposal_date');
$this->type('2000000','proposal_value');
$this->type('Deskripsi project baru','description');
$this->type('Project Baru', 'name');
$this->select('', 'customer_id');
$this->type('2016-04-15', 'proposal_date');
$this->type('2000000', 'proposal_value');
$this->type('Deskripsi project baru', 'description');
$this->press(trans('project.create'));
$this->seePageIs(route('projects.create'));
$this->notSeeInDatabase('projects', ['name' => 'Project Baru', 'proposal_value' => '2000000']);
$this->type('Customer Baru','customer_name');
$this->type('email@customer.baru','customer_email');
$this->type('Customer Baru', 'customer_name');
$this->type('email@customer.baru', 'customer_email');
$this->press(trans('project.create'));
$this->see(trans('project.created'));
$this->see('Project Baru');
@ -77,7 +76,7 @@ class ManageProjectsTest extends TestCase
$task = factory(Task::class)->create(['feature_id' => $feature->id]);
$payment = factory(Payment::class)->create(['project_id' => $project->id]);
$this->visit('projects/' . $project->id);
$this->visit('projects/'.$project->id);
$this->click(trans('app.edit'));
$this->click(trans('app.delete'));
$this->press(trans('app.delete_confirm_button'));
@ -113,21 +112,21 @@ class ManageProjectsTest extends TestCase
$project = factory(Project::class)->create(['owner_id' => $users[0]->id]);
$users[1]->assignRole('customer');
$this->visit('projects/' . $project->id . '/edit');
$this->seePageIs('projects/' . $project->id . '/edit');
$this->type('Edit Project','name');
$this->type('2016-04-15','proposal_date');
$this->type('2016-04-25','start_date');
$this->type('2016-05-05','end_date');
$this->type(2000000,'proposal_value');
$this->type(2000000,'project_value');
$this->select(4,'status_id');
$this->select($users[1]->id,'customer_id');
$this->type('Edit deskripsi project','description');
$this->visit('projects/'.$project->id.'/edit');
$this->seePageIs('projects/'.$project->id.'/edit');
$this->type('Edit Project', 'name');
$this->type('2016-04-15', 'proposal_date');
$this->type('2016-04-25', 'start_date');
$this->type('2016-05-05', 'end_date');
$this->type(2000000, 'proposal_value');
$this->type(2000000, 'project_value');
$this->select(4, 'status_id');
$this->select($users[1]->id, 'customer_id');
$this->type('Edit deskripsi project', 'description');
$this->press(trans('project.update'));
$this->seeInDatabase('projects',[
$this->seeInDatabase('projects', [
'id' => $project->id,
'name' => 'Edit Project',
'proposal_date' => '2016-04-15',
@ -151,11 +150,11 @@ class ManageProjectsTest extends TestCase
$this->seePageIs(route('projects.index'));
$this->click(trans('project.create'));
$this->seePageIs(route('projects.create'));
$this->type('','name');
$this->select($users[1]->id,'customer_id');
$this->type('2016-04-15aa','proposal_date');
$this->type('','proposal_value');
$this->type('Deskripsi project baru','description');
$this->type('', 'name');
$this->select($users[1]->id, 'customer_id');
$this->type('2016-04-15aa', 'proposal_date');
$this->type('', 'proposal_value');
$this->type('Deskripsi project baru', 'description');
$this->press(trans('project.create'));
$this->seePageIs(route('projects.create'));
$this->see('Mohon periksa kembali form isian Anda.');
@ -179,5 +178,4 @@ class ManageProjectsTest extends TestCase
'status_id' => 2,
]);
}
}

36
tests/Feature/ManageSubscriptionsTest.php

@ -31,17 +31,17 @@ class ManageSubscriptionsTest extends TestCase
$this->seePageIs('subscriptions/create');
// Fill Form
$this->type('www.domain.com','domain_name');
$this->type(100000,'domain_price');
$this->type('100000','epp_code');
$this->type('3GB','hosting_capacity');
$this->type(500000,'hosting_price');
$this->type('2015-05-02','start_date');
$this->type('2016-05-02','due_date');
$this->type('www.domain.com', 'domain_name');
$this->type(100000, 'domain_price');
$this->type('100000', 'epp_code');
$this->type('3GB', 'hosting_capacity');
$this->type(500000, 'hosting_price');
$this->type('2015-05-02', 'start_date');
$this->type('2016-05-02', 'due_date');
$this->select($project->id, 'project_id');
$this->select($customer->id, 'customer_id');
$this->select($vendor->id, 'vendor_id');
$this->type('','remark');
$this->type('', 'remark');
$this->press(trans('subscription.create'));
$this->seePageIs('subscriptions');
@ -74,22 +74,22 @@ class ManageSubscriptionsTest extends TestCase
$subscription = factory(Subscription::class)->create(['customer_id' => $customer->id, 'project_id' => $project->id]);
$this->visit('subscriptions/' . $subscription->id . '/edit');
$this->seePageIs('subscriptions/' . $subscription->id . '/edit');
$this->visit('subscriptions/'.$subscription->id.'/edit');
$this->seePageIs('subscriptions/'.$subscription->id.'/edit');
// Fill Form
$this->type($eppCode = str_random(10),'epp_code');
$this->type('4GB','hosting_capacity');
$this->type(500000,'hosting_price');
$this->type('2015-05-02','start_date');
$this->type('2016-05-02','due_date');
$this->type($eppCode = str_random(10), 'epp_code');
$this->type('4GB', 'hosting_capacity');
$this->type(500000, 'hosting_price');
$this->type('2015-05-02', 'start_date');
$this->type('2016-05-02', 'due_date');
$this->select($project->id, 'project_id');
$this->select($customer->id, 'customer_id');
$this->select($vendor->id, 'vendor_id');
$this->select(1,'status_id');
$this->select(1, 'status_id');
$this->press(trans('subscription.update'));
$this->seePageIs('subscriptions/' . $subscription->id . '/edit');
$this->seePageIs('subscriptions/'.$subscription->id.'/edit');
$this->see(trans('subscription.updated'));
$this->seeInDatabase('subscriptions', [
'epp_code' => $eppCode,
@ -133,7 +133,7 @@ class ManageSubscriptionsTest extends TestCase
$this->visit('/subscriptions');
$this->click(trans('app.show'));
$this->seePageIs('subscriptions/' . $subscription->id);
$this->seePageIs('subscriptions/'.$subscription->id);
$this->see(trans('subscription.show'));
$this->see($subscription->domain_name);
$this->see(formatRp($subscription->domain_price));

35
tests/Feature/ManageTasksTest.php

@ -3,7 +3,6 @@
namespace Tests\Feature;
use App\Entities\Projects\Feature;
use App\Entities\Projects\Project;
use App\Entities\Projects\Task;
use App\Entities\Users\User;
use Tests\TestCase;
@ -18,19 +17,19 @@ class ManageTasksTest extends TestCase
$this->actingAs($user);
$feature = factory(Feature::class)->create(['worker_id' => $user->id]);
$this->visit('features/' . $feature->id);
$this->seePageIs('features/' . $feature->id);
$this->visit('features/'.$feature->id);
$this->seePageIs('features/'.$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->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->seePageIs('features/' . $feature->id);
$this->seePageIs('features/'.$feature->id);
$this->see(trans('task.created'));
$this->seeInDatabase('tasks', [
'name' => 'Nama Task Baru',
@ -52,18 +51,18 @@ class ManageTasksTest extends TestCase
$task = factory(Task::class)->create(['feature_id' => $feature->id]);
$this->visit('features/' . $feature->id);
$this->click($task->id . '-tasks-edit');
$this->seePageIs('features/' . $feature->id . '?action=task_edit&task_id=' . $task->id);
$this->visit('features/'.$feature->id);
$this->click($task->id.'-tasks-edit');
$this->seePageIs('features/'.$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->type('Nama Task Edit', 'name');
$this->type(77, 'progress');
$this->press(trans('task.update'));
$this->seePageIs('features/' . $feature->id);
$this->seePageIs('features/'.$feature->id);
$this->see(trans('task.updated'));
$this->seeInDatabase('tasks', [
'name' => 'Nama Task Edit',
@ -84,11 +83,11 @@ class ManageTasksTest extends TestCase
$task = factory(Task::class)->create(['feature_id' => $feature->id]);
$this->visit('features/' . $feature->id);
$this->click($task->id . '-tasks-delete');
$this->visit('features/'.$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('features/'.$feature->id);
$this->see(trans('task.deleted'));
}
@ -105,7 +104,7 @@ class ManageTasksTest extends TestCase
// $tasks = factory(Task::class, 5)->create(['feature_id' => $feature->id]);
// $this->assertEquals(5, $tasks->count());
// $this->visit('features/' . $feature->id);
// $this->visit('features/'.$feature->id);
// $this->see($tasks[1]->name);
// $this->see($tasks[1]->progress);
// $this->see($tasks[1]->description);

10
tests/Feature/ManageUsersTest.php

@ -28,7 +28,7 @@ class ManageUsersTest extends TestCase
$this->see(trans('user.created'));
$this->see('Nama User');
$this->see('user@mail.com');
$this->seeInDatabase('users',['name' => 'Nama User', 'email' => 'user@mail.com']);
$this->seeInDatabase('users', ['name' => 'Nama User', 'email' => 'user@mail.com']);
}
/** @test */
@ -41,11 +41,11 @@ class ManageUsersTest extends TestCase
$user2 = factory(User::class)->create();
$user2->assignRole('customer');
$this->visit('users/' . $user2->id . '/edit');
$this->visit('users/'.$user2->id.'/edit');
$this->type('Ganti nama User', 'name');
$this->type('member@mail.dev', 'email');
$this->press(trans('user.update'));
$this->seePageIs('users/' . $user2->id . '/edit');
$this->seePageIs('users/'.$user2->id.'/edit');
$this->see(trans('user.updated'));
$this->see('Ganti nama User');
$this->see('member@mail.dev');
@ -62,10 +62,10 @@ class ManageUsersTest extends TestCase
$user2 = factory(User::class)->create();
$user2->assignRole('customer');
$this->visit('users/' . $user2->id . '/edit');
$this->visit('users/'.$user2->id.'/edit');
$this->seeInDatabase('users', ['id' => $user2->id, 'name' => $user2->name,'email' => $user2->email]);
$this->click(trans('app.delete'));
$this->seePageIs('users/' . $user2->id . '/delete');
$this->seePageIs('users/'.$user2->id.'/delete');
$this->press(trans('app.delete_confirm_button'));
$this->seePageIs('users');
$this->see(trans('user.deleted'));

34
tests/Feature/Payments/ManagePaymentsTest.php

@ -27,12 +27,12 @@ class ManagePaymentsTest extends TestCase
// Fill Form
$this->seePageIs('payments/create');
$this->type('2015-05-01','date');
$this->select(1,'in_out');
$this->type(1000000,'amount');
$this->type('2015-05-01', 'date');
$this->select(1, 'in_out');
$this->type(1000000, 'amount');
$this->select($project->id, 'project_id');
$this->select($customer->id, 'customer_id');
$this->type('Pembayaran DP','description');
$this->type('Pembayaran DP', 'description');
$this->press(trans('payment.create'));
$this->see(trans('payment.created'));
@ -58,13 +58,13 @@ class ManagePaymentsTest extends TestCase
// Fill Form
$this->seePageIs('payments/create');
$this->type('2015-05-01','date');
$this->select(0,'in_out');
$this->select(3,'type_id');
$this->type(1000000,'amount');
$this->type('2015-05-01', 'date');
$this->select(0, 'in_out');
$this->select(3, 'type_id');
$this->type(1000000, 'amount');
$this->select($project->id, 'project_id');
$this->select($customer->id, 'customer_id');
$this->type('Pembayaran DP','description');
$this->type('Pembayaran DP', 'description');
$this->press(trans('payment.create'));
$this->see(trans('payment.created'));
@ -85,15 +85,15 @@ class ManagePaymentsTest extends TestCase
$payment = factory(Payment::class)->create(['customer_id' => $customer->id, 'project_id' => $project->id, 'owner_id' => $user->id]);
$this->visit('payments/' . $payment->id . '/edit');
$this->seePageIs('payments/' . $payment->id . '/edit');
$this->type('2016-05-20','date');
$this->visit('payments/'.$payment->id.'/edit');
$this->seePageIs('payments/'.$payment->id.'/edit');
$this->type('2016-05-20', 'date');
$this->select(1, 'in_out');
$this->select(3,'type_id');
$this->type(1234567890,'amount');
$this->select(3, 'type_id');
$this->type(1234567890, 'amount');
$this->press(trans('payment.update'));
$this->seePageIs('payments/' . $payment->id);
$this->seePageIs('payments/'.$payment->id);
$this->see(trans('payment.updated'));
$this->seeInDatabase('payments', [
'customer_id' => $customer->id,
@ -115,7 +115,7 @@ class ManagePaymentsTest extends TestCase
$this->click(trans('app.edit'));
$this->click(trans('payment.delete'));
$this->press(trans('app.delete_confirm_button'));
$this->seePageIs('projects/' . $payment->project_id . '/payments');
$this->seePageIs('projects/'.$payment->project_id.'/payments');
$this->see(trans('payment.deleted'));
}
@ -131,7 +131,7 @@ class ManagePaymentsTest extends TestCase
$this->visit('/payments');
$this->click('Lihat');
$this->seePageIs('payments/' . $payment->id);
$this->seePageIs('payments/'.$payment->id);
$this->see(trans('payment.show'));
$this->see($payment->date);
$this->see(formatRp($payment->amount));

3
tests/Feature/Payments/PaymentSearchTest.php

@ -4,9 +4,6 @@ namespace Tests\Feature\Payments;
use App\Entities\Payments\Payment;
use App\Entities\Projects\Project;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Tests\TestCase;
class PaymentSearchTest extends TestCase

4
tests/Feature/Projects/UploadFilesTest.php

@ -37,7 +37,7 @@ class UploadFilesTest extends TestCase
]);
$file = $project->files->first();
Storage::disk('avatar')->assertExists('public/files/' . $file->filename);
Storage::disk('avatar')->assertExists('public/files/'.$file->filename);
}
/** @test */
@ -78,6 +78,6 @@ class UploadFilesTest extends TestCase
'description' => 'Edit Deskripsi file yang diuplod.',
]);
Storage::disk('avatar')->assertExists('public/files/' . $file->filename);
Storage::disk('avatar')->assertExists('public/files/'.$file->filename);
}
}

2
tests/TestCase.php

@ -2,7 +2,6 @@
namespace Tests;
use App\Entities\Users\Role;
use App\Entities\Users\User;
use Tests\Traits\DatabaseMigrateSeeds;
@ -40,7 +39,6 @@ class TestCase extends \Laravel\BrowserKitTesting\TestCase
if (isset($uses[DatabaseMigrateSeeds::class])) {
$this->runDatabaseMigrateSeeds();
}
}
protected function adminUserSigningIn()

29
tests/Unit/Models/ProjectTest.php

@ -4,7 +4,6 @@ namespace Tests\Unit\Models;
use App\Entities\Payments\Payment;
use App\Entities\Projects\Feature;
use App\Entities\Projects\File;
use App\Entities\Projects\Project;
use App\Entities\Projects\Task;
use App\Entities\Subscriptions\Subscription;
@ -19,8 +18,8 @@ class ProjectTest extends TestCase
{
$project = factory(Project::class)->create();
$feature = factory(Feature::class)->create(['project_id' => $project->id]);
$this->assertTrue($project->features instanceOf Collection);
$this->assertTrue($project->features->first() instanceOf Feature);
$this->assertTrue($project->features instanceof Collection);
$this->assertTrue($project->features->first() instanceof Feature);
}
/** @test */
@ -28,8 +27,8 @@ class ProjectTest extends TestCase
{
$project = factory(Project::class)->create();
$feature = factory(Feature::class)->create(['project_id' => $project->id, 'type_id' => 1]);
$this->assertTrue($project->mainFeatures instanceOf Collection);
$this->assertTrue($project->mainFeatures->first() instanceOf Feature);
$this->assertTrue($project->mainFeatures instanceof Collection);
$this->assertTrue($project->mainFeatures->first() instanceof Feature);
}
/** @test */
@ -37,8 +36,8 @@ class ProjectTest extends TestCase
{
$project = factory(Project::class)->create();
$feature = factory(Feature::class)->create(['project_id' => $project->id, 'type_id' => 2]);
$this->assertTrue($project->additionalFeatures instanceOf Collection);
$this->assertTrue($project->additionalFeatures->first() instanceOf Feature);
$this->assertTrue($project->additionalFeatures instanceof Collection);
$this->assertTrue($project->additionalFeatures->first() instanceof Feature);
}
/** @test */
@ -47,8 +46,8 @@ class ProjectTest extends TestCase
$project = factory(Project::class)->create();
$feature = factory(Feature::class)->create(['project_id' => $project->id, 'type_id' => 2]);
$tasks = factory(Task::class, 2)->create(['feature_id' => $feature->id]);
$this->assertTrue($project->tasks instanceOf Collection);
$this->assertTrue($project->tasks->first() instanceOf Task);
$this->assertTrue($project->tasks instanceof Collection);
$this->assertTrue($project->tasks->first() instanceof Task);
}
/** @test */
@ -56,8 +55,8 @@ class ProjectTest extends TestCase
{
$project = factory(Project::class)->create();
$payment = factory(Payment::class)->create(['project_id' => $project->id]);
$this->assertTrue($project->payments instanceOf Collection);
$this->assertTrue($project->payments->first() instanceOf Payment);
$this->assertTrue($project->payments instanceof Collection);
$this->assertTrue($project->payments->first() instanceof Payment);
}
/** @test */
@ -65,15 +64,15 @@ class ProjectTest extends TestCase
{
$project = factory(Project::class)->create();
$subscription = factory(Subscription::class)->create(['project_id' => $project->id]);
$this->assertTrue($project->subscriptions instanceOf Collection);
$this->assertTrue($project->subscriptions->first() instanceOf Subscription);
$this->assertTrue($project->subscriptions instanceof Collection);
$this->assertTrue($project->subscriptions->first() instanceof Subscription);
}
/** @test */
public function it_belongs_to_a_customer()
{
$project = factory(Project::class)->create();
$this->assertTrue($project->customer instanceOf User);
$this->assertTrue($project->customer instanceof User);
}
/** @test */
@ -130,6 +129,6 @@ class ProjectTest extends TestCase
public function it_has_many_files()
{
$project = factory(Project::class)->create();
$this->assertTrue($project->files instanceOf Collection);
$this->assertTrue($project->files instanceof Collection);
}
}
Loading…
Cancel
Save