mirror of
https://gitlab.com/omair-personal/exchange.git
synced 2026-08-19 04:24:08 +00:00
New Route for booking cancel. Fix bookingTest hardcoded link. Add Cancel function to bookingcontroller. Get Latest Rate for bookingController@store.
This commit is contained in:
@@ -18,77 +18,90 @@ use App\Booking;
|
||||
class BookingTest extends TestCase
|
||||
{
|
||||
protected $user;
|
||||
protected $booking;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
Artisan::call('db:seed');
|
||||
$this->user = factory(User::class)->create();
|
||||
$this->booking = factory(Booking::class)->create([
|
||||
'user_id' => $this->user->id
|
||||
]);
|
||||
}
|
||||
|
||||
public function testPost()
|
||||
{
|
||||
$response =
|
||||
$this->actingAs($this->user)
|
||||
->postJson('/api/booking/', [
|
||||
'account_name' => 'johnny',
|
||||
'account_num' => '1234567',
|
||||
'bank_name' => 'myabnak',
|
||||
'bank_branch' => 'banking',
|
||||
'company_name' => 'besaras',
|
||||
'company_address' => 'californina',
|
||||
'bank_address' => 'cyber',
|
||||
'swift_code' => '123wert',
|
||||
'cnap' => '2131rew',
|
||||
'term' => 'x2_cash',
|
||||
'amount' => '14000',
|
||||
'rmb_book_amount' => '2131',
|
||||
'rmb_book_pay_method' => '2131rea',
|
||||
'rmb_book_account_name' => '2131rew',
|
||||
'rmb_book_acc_no' => '2131',
|
||||
'rmb_book_bank_branch' => '2131rew',
|
||||
'usd_book_amount' => '2131',
|
||||
'usd_book_pay_method' => '2131rew',
|
||||
'usd_book_company_name' => '2131rew',
|
||||
'usd_book_company_address' => '2131rew',
|
||||
'usd_book_swift_code' => '2131rew',
|
||||
'usd_book_cnap' => '2131rew',
|
||||
'usd_book_bank_branch' => '2131rew',
|
||||
'verification_status' => '1'
|
||||
]);
|
||||
$response->assertStatus(201);
|
||||
->postJson('/api/booking/', [
|
||||
'account_name' => 'johnny',
|
||||
'account_num' => '1234567',
|
||||
'bank_name' => 'myabnak',
|
||||
'bank_branch' => 'banking',
|
||||
'company_name' => 'besaras',
|
||||
'company_address' => 'californina',
|
||||
'bank_address' => 'cyber',
|
||||
'swift_code' => '123wert',
|
||||
'cnap' => '2131rew',
|
||||
'term' => 'x2_cash',
|
||||
'amount' => '14000',
|
||||
'rmb_book_amount' => '2131',
|
||||
'rmb_book_pay_method' => '2131rea',
|
||||
'rmb_book_account_name' => '2131rew',
|
||||
'rmb_book_acc_no' => '2131',
|
||||
'rmb_book_bank_branch' => '2131rew',
|
||||
'usd_book_amount' => '2131',
|
||||
'usd_book_pay_method' => '2131rew',
|
||||
'usd_book_company_name' => '2131rew',
|
||||
'usd_book_company_address' => '2131rew',
|
||||
'usd_book_swift_code' => '2131rew',
|
||||
'usd_book_cnap' => '2131rew',
|
||||
'usd_book_bank_branch' => '2131rew',
|
||||
'verification_status' => '1'
|
||||
])
|
||||
->assertStatus(201);
|
||||
}
|
||||
|
||||
public function testuploadbankslip()
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
Storage::fake('bankslip_url');
|
||||
$bankslip_url = UploadedFile::fake()->image('comp.jpg');
|
||||
|
||||
if(!file_exists($bankslip_url)){
|
||||
$response->assertStatus(400);
|
||||
}
|
||||
|
||||
$response = $this->json('POST', '/api/booking/1/upload-user-bankslip', [
|
||||
'bankslip_url' => $bankslip_url,
|
||||
'transfer_amount' => '9000'
|
||||
]);
|
||||
$response->assertStatus(200);
|
||||
$this->actingAs($this->user)
|
||||
->json('POST', '/api/booking/' . $this->booking->id . '/upload-user-bankslip', [
|
||||
'bankslip_url' => $bankslip_url,
|
||||
'transfer_amount' => '9000'
|
||||
])
|
||||
->assertSuccessful();
|
||||
}
|
||||
|
||||
public function testuploadPO()
|
||||
{
|
||||
$this->actingAs($this->user);
|
||||
Storage::fake('image_url');
|
||||
$image_url = UploadedFile::fake()->image('comp.jpg');
|
||||
|
||||
if(!file_exists($image_url)){
|
||||
$response->assertStatus(400);
|
||||
}
|
||||
|
||||
$response = $this->json('POST', '/api/booking/1/upload-po', [
|
||||
'image_url' => UploadedFile::fake()->image('comp.jpg'),
|
||||
'amount' => '12345'
|
||||
]);
|
||||
$response->assertStatus(200);
|
||||
|
||||
$this->actingAs($this->user)
|
||||
->json('POST', '/api/booking/' . $this->booking->id . '/upload-po', [
|
||||
'image_url' => UploadedFile::fake()->image('comp.jpg'),
|
||||
'amount' => '12345'
|
||||
])
|
||||
->assertSuccessful();
|
||||
|
||||
}
|
||||
|
||||
public function testCancel()
|
||||
{
|
||||
$this->actingAs($this->user)
|
||||
->json('POST','/api/booking/' . $this->booking->id . '/cancel', [])
|
||||
->assertSuccessful();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user