mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-09-02 11:24:03 +00:00
fix merge problem, create factory, fix controller problem in SO and WRN, setup a testing database
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\WithFaker;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
class ShippingorderTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGETtheindex()
|
||||
{
|
||||
$response = $this->json('GET', '/api/so');
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
public function testGET()
|
||||
{
|
||||
$response = $this->json('GET', '/api/so/{so_id}');
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
public function testPOSTso()
|
||||
{
|
||||
$response = $this->json('POST', '/api/so',
|
||||
|
||||
[
|
||||
'id' => '1',
|
||||
'ff_id' => '1',
|
||||
'supplier_company_name' => 'Testing',
|
||||
'supplier_contact_person' => 'Testing',
|
||||
'supplier_contact_person_no' => '1234',
|
||||
'delivery_id' => '1',
|
||||
'warehouse_id' => '1',
|
||||
|
||||
'soitem' => [
|
||||
0 => [
|
||||
'so_id' => '1',
|
||||
'status' => '1',
|
||||
'order_id' => '1',
|
||||
'brand_no' => '1',
|
||||
'model_no' => '1',
|
||||
'item_code' => '1',
|
||||
'quantity_of_item' => '1',
|
||||
'uom' => 'test',
|
||||
'quantity_of_carton' => '1',
|
||||
'packaging_type' => 'Testing',
|
||||
'packaging_height' => '123',
|
||||
'packaging_width' => '123',
|
||||
'packaging_depth' => '123',
|
||||
'packaging_gross' => '123',
|
||||
'packaging_nett' => '123',
|
||||
],
|
||||
1 => [
|
||||
'so_id' => '1',
|
||||
'status' => '1',
|
||||
'order_id' => '1',
|
||||
'brand_no' => '1',
|
||||
'model_no' => '1',
|
||||
'item_code' => '1',
|
||||
'quantity_of_item' => '1',
|
||||
'uom' => 'test',
|
||||
'quantity_of_carton' => '1',
|
||||
'packaging_type' => 'Testing',
|
||||
'packaging_height' => '123',
|
||||
'packaging_width' => '123',
|
||||
'packaging_depth' => '123',
|
||||
'packaging_gross' => '123',
|
||||
'packaging_nett' => '123',
|
||||
]
|
||||
]
|
||||
]);
|
||||
|
||||
$response->assertStatus(201);
|
||||
}
|
||||
|
||||
public function testDELETEso()
|
||||
{
|
||||
$response = $this->json('DELETE', '/api/so/8');
|
||||
|
||||
$response->assertStatus(204);
|
||||
}
|
||||
|
||||
public function testDELETEsoitem()
|
||||
{
|
||||
$response = $this->json('DELETE', '/api/so/soitem/3');
|
||||
|
||||
$response->assertStatus(204);
|
||||
}
|
||||
|
||||
public function testPUTso()
|
||||
{
|
||||
|
||||
|
||||
$response = $this->json('PUT', '/api/so/2', [
|
||||
|
||||
'id' => '1',
|
||||
'ff_id' => '1',
|
||||
'supplier_company_name' => 'Testinggggggggggggggggggggg',
|
||||
'supplier_contact_person' => 'Testing',
|
||||
'supplier_contact_person_no' => '1234',
|
||||
'delivery_id' => '1',
|
||||
'warehouse_id' => '1',
|
||||
|
||||
]);
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
public function testPUTsoitem()
|
||||
{
|
||||
|
||||
|
||||
$response = $this->json('PUT', '/api/so/soitem/1', [
|
||||
|
||||
'so_id' => '2',
|
||||
'status' => '1',
|
||||
'order_id' => '2',
|
||||
'brand_no' => '2',
|
||||
'model_no' => '2',
|
||||
'item_code' => '2',
|
||||
'quantity_of_item' => '2',
|
||||
'uom' => 'test',
|
||||
'quantity_of_carton' => '2',
|
||||
'packaging_type' => 'Testinggggggggggggggggggg',
|
||||
'packaging_height' => '123',
|
||||
'packaging_width' => '123',
|
||||
'packaging_depth' => '123',
|
||||
'packaging_gross' => '123',
|
||||
'packaging_nett' => '123',
|
||||
|
||||
]);
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,9 @@ 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
|
||||
@@ -16,13 +19,13 @@ class WarehouseReceiveNoteTest extends TestCase
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGET()
|
||||
{
|
||||
$response = $this->json('GET', '/api/warehousearr');
|
||||
// public function testGET()
|
||||
// {
|
||||
// $response = $this->json('GET', '/api/warehousearr');
|
||||
|
||||
$response->assertStatus(200);
|
||||
// $response->assertStatus(200);
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
public function testPOST()
|
||||
{
|
||||
@@ -51,11 +54,10 @@ class WarehouseReceiveNoteTest extends TestCase
|
||||
'isDamaged'=> '1',
|
||||
'status'=> 'ok',
|
||||
'image'=> 'test.jpg',
|
||||
'wa_id'=> '4',
|
||||
'soitem_id'=> '4'
|
||||
'wa_id'=> '11',
|
||||
],
|
||||
1 => [
|
||||
'description'=> 'CIEFhuhuuh',
|
||||
'description'=> 'CIE',
|
||||
'nominal_ctn'=> '1',
|
||||
'actual_ctn'=> '1',
|
||||
'nominal_measurement'=> '1',
|
||||
@@ -66,14 +68,13 @@ class WarehouseReceiveNoteTest extends TestCase
|
||||
'isDamaged'=> '1',
|
||||
'status'=> 'ok',
|
||||
'image'=> 'test.jpg',
|
||||
'wa_id'=> '4',
|
||||
'soitem_id'=> '4'
|
||||
'wa_id'=> '11',
|
||||
]
|
||||
]
|
||||
]);
|
||||
|
||||
dd($response->getContent());
|
||||
// $response->assertStatus(201);
|
||||
// dd($response->getContent());
|
||||
$response->assertStatus(201);
|
||||
|
||||
}
|
||||
|
||||
@@ -120,12 +121,23 @@ class WarehouseReceiveNoteTest extends TestCase
|
||||
// Storage::fake('warehouse_picture');
|
||||
|
||||
// $response = $this->actingAs($this->user)
|
||||
// ->json('POST', '/warehousearr/warehouse_picture/{wa_id}', [
|
||||
// 'warehouse_picture' => UploadedFile::fake()->image('comp.jpg')
|
||||
// ->json('POST', '/warehousearr/warehouse_picture/1', [
|
||||
// 'warehouse_picture' => UploadedFile::fake()->image('test.jpg')
|
||||
// ]);
|
||||
// // dd($response->getContent());
|
||||
// $response->assertStatus(201);
|
||||
// }
|
||||
|
||||
// public function testUploadWarehouseItemImage()
|
||||
// {
|
||||
// Storage::fake('warehouse_picture');
|
||||
|
||||
// $response = $this->actingAs($this->user)
|
||||
// ->json('POST', '/warehousearr/warehouse_item_picture/1', [
|
||||
// 'warehouse_item_picture' => UploadedFile::fake()->image('test.jpg')
|
||||
// ]);
|
||||
// // dd($response->getContent());
|
||||
// $response->assertStatus(201);
|
||||
// }
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user