add upload invoice and test

This commit is contained in:
Too
2018-06-21 13:15:36 +08:00
parent 93d866f432
commit db7e30ea95
7 changed files with 434 additions and 312 deletions
+21 -3
View File
@@ -107,11 +107,10 @@ class BookingTest extends TestCase
$this->actingAs($this->user)
->json('POST', '/api/booking/' . $this->booking->id . '/upload-po', [
'file' => UploadedFile::fake()->image('comp.jpg'),
'file' => $image_url,
'amount' => '12345'
])
->assertSuccessful();
}
public function testCancel()
@@ -128,7 +127,6 @@ class BookingTest extends TestCase
->assertSuccessful();
}
public function testRejectBankSlip()
{
$this->actingAs($this->user)
@@ -137,4 +135,24 @@ class BookingTest extends TestCase
])
->assertSuccessful();
}
// Only this is Admin permision required
public function testUploadInvoice(){
$this->user->roles()->sync([]);
$this->user->attachRole(Role::Where('name','admin')->first());
Storage::fake('invoice_url');
$invoice_url = UploadedFile::fake()->create('document.pdf');
if(!file_exists($invoice_url)){
$response->assertStatus(400);
}
$this->actingAs($this->user)
->json('POST', '/api/booking/' . $this->booking->id . '/upload-invoice', [
'invoice_url' => $invoice_url,
'amount' => '12345'
])
->assertSuccessful();
}
}