|
|
|
@ -2,19 +2,20 @@ |
|
|
|
|
|
|
|
namespace Tests\Feature\Payments; |
|
|
|
|
|
|
|
use App\Entities\Partners\Customer; |
|
|
|
use App\Entities\Partners\Vendor; |
|
|
|
use App\Entities\Payments\Payment; |
|
|
|
use App\Entities\Projects\Project; |
|
|
|
use App\Entities\Users\User; |
|
|
|
use Tests\TestCase; |
|
|
|
|
|
|
|
class ManagePaymentsTest extends TestCase |
|
|
|
{ |
|
|
|
/** @test */ |
|
|
|
public function admin_can_entry_project_a_cashin_payment() |
|
|
|
public function admin_can_entry_project_an_income_payment() |
|
|
|
{ |
|
|
|
$user = $this->adminUserSigningIn(); |
|
|
|
$customer = $this->createUser('customer'); |
|
|
|
$project = factory(Project::class)->create(); |
|
|
|
$user = $this->adminUserSigningIn(); |
|
|
|
$customer = factory(Customer::class)->create(); |
|
|
|
$project = factory(Project::class)->create(); |
|
|
|
|
|
|
|
$this->visit(route('payments.index')); |
|
|
|
$this->seePageIs(route('payments.index')); |
|
|
|
@ -31,15 +32,20 @@ class ManagePaymentsTest extends TestCase |
|
|
|
$this->press(trans('payment.create')); |
|
|
|
|
|
|
|
$this->see(trans('payment.created')); |
|
|
|
$this->seeInDatabase('payments', ['project_id' => $project->id,'amount' => 1000000,'in_out' => 1,'date' => '2015-05-01']); |
|
|
|
$this->seeInDatabase('payments', [ |
|
|
|
'project_id' => $project->id, |
|
|
|
'amount' => 1000000, |
|
|
|
'in_out' => 1, |
|
|
|
'date' => '2015-05-01', |
|
|
|
'customer_id' => $customer->id, |
|
|
|
]); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** @test */ |
|
|
|
public function admin_can_entry_project_a_cashout_payment() |
|
|
|
public function admin_can_entry_project_an_expanse_payment() |
|
|
|
{ |
|
|
|
$user = $this->adminUserSigningIn(); |
|
|
|
$customer = $this->createUser('customer'); |
|
|
|
$user = $this->adminUserSigningIn(); |
|
|
|
$vendor = factory(Vendor::class)->create(); |
|
|
|
$project = factory(Project::class)->create(); |
|
|
|
|
|
|
|
$this->visit(route('payments.index')); |
|
|
|
@ -53,22 +59,32 @@ class ManagePaymentsTest extends TestCase |
|
|
|
$this->select(3, 'type_id'); |
|
|
|
$this->type(1000000, 'amount'); |
|
|
|
$this->select($project->id, 'project_id'); |
|
|
|
$this->select($customer->id, 'customer_id'); |
|
|
|
$this->select($vendor->id, 'customer_id'); |
|
|
|
$this->type('Pembayaran DP', 'description'); |
|
|
|
$this->press(trans('payment.create')); |
|
|
|
|
|
|
|
$this->see(trans('payment.created')); |
|
|
|
$this->seeInDatabase('payments', ['project_id' => $project->id,'amount' => 1000000,'in_out' => 0,'date' => '2015-05-01']); |
|
|
|
$this->seeInDatabase('payments', [ |
|
|
|
'project_id' => $project->id, |
|
|
|
'amount' => 1000000, |
|
|
|
'in_out' => 0, |
|
|
|
'date' => '2015-05-01', |
|
|
|
'customer_id' => $vendor->id, |
|
|
|
]); |
|
|
|
} |
|
|
|
|
|
|
|
/** @test */ |
|
|
|
public function admin_can_edit_payment_data() |
|
|
|
{ |
|
|
|
$user = $this->adminUserSigningIn(); |
|
|
|
$customer = $this->createUser('customer'); |
|
|
|
$project = factory(Project::class)->create(); |
|
|
|
$user = $this->adminUserSigningIn(); |
|
|
|
$customer = factory(Customer::class)->create(); |
|
|
|
$project = factory(Project::class)->create(); |
|
|
|
|
|
|
|
$payment = factory(Payment::class)->create(['customer_id' => $customer->id, 'project_id' => $project->id, 'owner_id' => $user->id]); |
|
|
|
$payment = factory(Payment::class)->create([ |
|
|
|
'customer_id' => $customer->id, |
|
|
|
'project_id' => $project->id, |
|
|
|
'owner_id' => $user->id, |
|
|
|
]); |
|
|
|
|
|
|
|
$this->visit(route('payments.edit', $payment->id)); |
|
|
|
$this->seePageIs(route('payments.edit', $payment->id)); |
|
|
|
@ -83,9 +99,9 @@ class ManagePaymentsTest extends TestCase |
|
|
|
$this->see(trans('payment.updated')); |
|
|
|
$this->seeInDatabase('payments', [ |
|
|
|
'customer_id' => $customer->id, |
|
|
|
'project_id' => $project->id, |
|
|
|
'date' => '2016-05-20', |
|
|
|
'amount' => 1234567890, |
|
|
|
'project_id' => $project->id, |
|
|
|
'date' => '2016-05-20', |
|
|
|
'amount' => 1234567890, |
|
|
|
]); |
|
|
|
} |
|
|
|
|
|
|
|
@ -109,7 +125,7 @@ class ManagePaymentsTest extends TestCase |
|
|
|
$user = $this->adminUserSigningIn(); |
|
|
|
|
|
|
|
$project = factory(Project::class)->create(['owner_id' => $user->id]); |
|
|
|
$payment = factory(Payment::class)->create(['project_id' => $project->id,'owner_id' => $user->id]); |
|
|
|
$payment = factory(Payment::class)->create(['project_id' => $project->id, 'owner_id' => $user->id]); |
|
|
|
|
|
|
|
$this->visit(route('payments.index')); |
|
|
|
$this->click(trans('app.show')); |
|
|
|
|