Files
izyim-api/tests/Unit/WarehouseReceiveNoteTest.php
T
Zain Fauzan Rofie Azizi 041c643bb1 ongoing testing
2018-06-06 15:27:46 +08:00

82 lines
2.1 KiB
PHP

<?php
namespace Tests\Unit;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use App\Warehousearr;
use App\Warehouseitem;
use Artisan;
class WarehouseReceiveNoteTest extends TestCase
{
public function setUp()
{
parent::setUp();
Artisan::call('db:seed');
}
public function testPUT()
{
$response = $this->json('PUT', '/api/warehousearr/1',
[
'so_id'=> '1',
'receive_on'=> '2018-06-04',
'transport_company_name'=> 'TESTTESTabc',
'consignment_note_no'=> '3',
'warehouse_receive_note_no'=> '3',
'receiving_person'=> 'TEST',
'marking_number'=> '3',
'image'=> 'test.jpg',
'warehouseitem' => [
0 => [
'description'=> 'TESTTESTabctest',
'nominal_ctn'=> '1',
'actual_ctn'=> '1',
'nominal_measurement'=> '1',
'actual_measurement'=> '1',
'nominal_weight'=> '1',
'actual_weight'=> '1',
'balance'=> '2',
'isDamaged'=> '1',
'status'=> 'ok',
'image'=> 'test.jpg',
],
]
]);
$response->assertStatus(201);
}
public function testUploadWarehouseImage()
{
Storage::fake('warehouse_picture');
$response = $this->json('POST', '/api/warehousearr/warehouse_picture/1', [
'warehouse_picture' => UploadedFile::fake()->image('test.jpg')
]);
$response->assertStatus(201);
}
public function testUploadWarehouseItemImage()
{
Storage::fake('warehouse_item_picture');
$response = $this->json('POST', '/api/warehousearr/warehouse_item_picture/1', [
'warehouse_item_picture' => UploadedFile::fake()->image('test.jpg')
]);
$response->assertStatus(201);
}
}