mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 04:14:04 +00:00
48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use Tests\TestCase;
|
|
use Illuminate\Foundation\Testing\WithFaker;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use Illuminate\Http\UploadedFile;
|
|
use Artisan;
|
|
|
|
class ChinaBankSlipTest extends TestCase
|
|
{
|
|
protected $user;
|
|
|
|
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
|
|
]);
|
|
$this->user->attachRole(Role::Where('name','admin')->first());
|
|
}
|
|
|
|
public function testStore(){
|
|
Storage::fake('file');
|
|
$size_in_kb = 3072; // 3072KB = 3MB
|
|
$china_bank_slips_path = UploadedFile::fake()->image('comp.jpg')->size($size_in_kb);
|
|
|
|
$response =
|
|
$this->postJson('api/booking/' . $user->id . 'upload-china-bankslip',[
|
|
'china_bank_slips' => $china_bank_slips_path,
|
|
'actual_transfer_amount' => '12',
|
|
'details' => "123123",
|
|
'date' => "123123"
|
|
]);
|
|
|
|
if(!file_exists($china_bank_slips_path) || $size_in_kb > 3072){
|
|
$response->assertStatus(400);
|
|
}
|
|
else{
|
|
$response->assertSuccessful();
|
|
}
|
|
}
|
|
}
|