mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-21 13:34:16 +00:00
completed the testing for the wrn, fixing testing error for so
This commit is contained in:
+1
-1
@@ -23,6 +23,6 @@ class So extends Model
|
||||
{
|
||||
return $this->hasMany('App\Warehousearr');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,14 +12,50 @@ use Faker\Generator as Faker;
|
||||
| model instances for testing / seeding your application's database.
|
||||
|
|
||||
*/
|
||||
// Manually creating the relationship tree.
|
||||
|
||||
$factory->define(App\So::class, function (Faker $faker) {
|
||||
return [
|
||||
'ff_id'=>'testing',
|
||||
'ff_id'=>'1',
|
||||
'supplier_company_name'=>'testing',
|
||||
'supplier_contact_person'=>'testing',
|
||||
'supplier_contact_person_no'=>'12345',
|
||||
'delivery_id'=>'12345',
|
||||
'warehouse_id'=>'testing',
|
||||
];
|
||||
'supplier_contact_person_no'=>'1',
|
||||
'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'=> 'testing',
|
||||
'quantity_of_carton'=> '1',
|
||||
'packaging_type'=> 'testing',
|
||||
'packaging_height'=> '1',
|
||||
'packaging_width'=> '1',
|
||||
'packaging_depth'=> '1',
|
||||
'packaging_gross'=> '1',
|
||||
'packaging_nett'=> '1',
|
||||
],
|
||||
1 => [
|
||||
'so_id'=> '1',
|
||||
'status'=> '1',
|
||||
'order_id'=> '1',
|
||||
'brand_no'=> '1',
|
||||
'model_no'=> '1',
|
||||
'item_code'=> '1',
|
||||
'quantity_of_item'=> '1',
|
||||
'uom'=> 'testing',
|
||||
'quantity_of_carton'=> '1',
|
||||
'packaging_type'=> 'testing',
|
||||
'packaging_height'=> '1',
|
||||
'packaging_width'=> '1',
|
||||
'packaging_depth'=> '1',
|
||||
'packaging_gross'=> '1',
|
||||
'packaging_nett'=> '1',
|
||||
]
|
||||
]
|
||||
];
|
||||
});
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This directory should contain each of the model factory definitions for
|
||||
| your application. Factories provide a convenient way to generate new
|
||||
| model instances for testing / seeding your application's database.
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(App\Warehousearr::class, function (Faker $faker) {
|
||||
return [
|
||||
|
||||
'so_id'=> function () {
|
||||
|
||||
return factory(App\So::class)->create()->id;
|
||||
|
||||
},
|
||||
'receive_on'=> '2018-03-01',
|
||||
'transport_company_name'=> 'testing',
|
||||
'consignment_note_no'=> '1',
|
||||
'warehouse_receive_note_no'=> '1',
|
||||
'receiving_person'=> 'testing',
|
||||
'marking_number'=> '1',
|
||||
'image'=> 'testing.jpg',
|
||||
'warehouseitem' => [
|
||||
0 => [
|
||||
'description'=> 'testing',
|
||||
'nominal_ctn'=> '1',
|
||||
'actual_ctn'=> '1',
|
||||
'nominal_measurement'=> '1',
|
||||
'actual_measurement'=> '1',
|
||||
'nominal_weight'=> '1',
|
||||
'actual_weight'=> '1',
|
||||
'balance'=> '1',
|
||||
'isDamaged'=> '1',
|
||||
'status'=> 'testing',
|
||||
'image'=> 'testing.jpg',
|
||||
'wa_id'=> '1',
|
||||
],
|
||||
1 => [
|
||||
'description'=> 'testing',
|
||||
'nominal_ctn'=> '1',
|
||||
'actual_ctn'=> '1',
|
||||
'nominal_measurement'=> '1',
|
||||
'actual_measurement'=> '1',
|
||||
'nominal_weight'=> '1',
|
||||
'actual_weight'=> '1',
|
||||
'balance'=> '2',
|
||||
'isDamaged'=> '1',
|
||||
'status'=> 'testing',
|
||||
'image'=> 'testing.jpg',
|
||||
'wa_id'=> '1',
|
||||
]
|
||||
]
|
||||
];
|
||||
});
|
||||
@@ -13,7 +13,9 @@ class DatabaseSeeder extends Seeder
|
||||
{
|
||||
$this->call(LaratrustSeeder::class);
|
||||
$this->call(UsersTableSeeder::class);
|
||||
//$this->call(UsersTableSeeder::class);
|
||||
$this->call(SoSeeder::class);
|
||||
$this->call(SoSeeder::class);
|
||||
$this->call(SoitemSeeder::class);
|
||||
$this->call(WarehousearrSeeder::class);
|
||||
$this->call(WarehouseitemSeeder::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,8 @@ class SoSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
DB::table('sos')->insert([
|
||||
|
||||
|
||||
'id' => '99',
|
||||
'ff_id' => '1',
|
||||
'supplier_company_name' => 'SEED',
|
||||
'supplier_contact_person' => 'SEED',
|
||||
|
||||
@@ -18,9 +18,8 @@ class SoitemSeeder extends Seeder
|
||||
|
||||
([
|
||||
|
||||
|
||||
'so_id' => '3',
|
||||
'status' => '0',
|
||||
'so_id' => '99',
|
||||
'status' => '1',
|
||||
'order_id' => '1',
|
||||
'brand_no' => '1',
|
||||
'model_no' => '1',
|
||||
@@ -39,8 +38,8 @@ class SoitemSeeder extends Seeder
|
||||
|
||||
]),
|
||||
([
|
||||
// 'id' => '8',
|
||||
'so_id' => '3',
|
||||
|
||||
'so_id' => '99',
|
||||
'status' => '0',
|
||||
'order_id' => '1',
|
||||
'brand_no' => '1',
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Carbon\Carbon;
|
||||
use App\Warehousearr;
|
||||
|
||||
class WarehousearrSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
DB::table('warehousearrs')->insert([
|
||||
|
||||
'so_id' => '99',
|
||||
'receive_on'=> Carbon::now()->format('Y-m-d H:i:s'),
|
||||
'transport_company_name'=> 'TEScief',
|
||||
'consignment_note_no'=> '1',
|
||||
'warehouse_receive_note_no'=> '1',
|
||||
'receiving_person'=> 'TEST',
|
||||
'marking_number'=> '1',
|
||||
'image'=> 'test.jpg',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Carbon\Carbon;
|
||||
use App\Warehouseitem;
|
||||
|
||||
class WarehouseitemSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
DB::table('warehouseitems')->insert([
|
||||
|
||||
([
|
||||
|
||||
'description'=> 'CIEFhuhuuh',
|
||||
'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',
|
||||
'wa_id'=> '1',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
|
||||
]),
|
||||
([
|
||||
|
||||
'description'=> 'CIEFhuhuuh',
|
||||
'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',
|
||||
'wa_id'=> '1',
|
||||
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||
]),
|
||||
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,14 @@ use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
class ShippingorderTest extends TestCase
|
||||
{
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
Artisan::call('db:seed');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
@@ -27,68 +35,14 @@ class ShippingorderTest extends TestCase
|
||||
$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()
|
||||
public function testDELETEso()
|
||||
{
|
||||
$response = $this->json('DELETE', '/api/so/8');
|
||||
|
||||
$response->assertStatus(204);
|
||||
}
|
||||
|
||||
public function testDELETEsoitem()
|
||||
public function testDELETEsoitem()
|
||||
{
|
||||
$response = $this->json('DELETE', '/api/so/soitem/3');
|
||||
|
||||
@@ -98,43 +52,34 @@ class ShippingorderTest extends TestCase
|
||||
public function testPUTso()
|
||||
{
|
||||
|
||||
|
||||
$response = $this->json('PUT', '/api/so/2', [
|
||||
|
||||
'id' => '1',
|
||||
'ff_id' => '1',
|
||||
'supplier_company_name' => 'Testinggggggggggggggggggggg',
|
||||
'supplier_company_name' => 'Testing',
|
||||
'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',
|
||||
'soitem' => [
|
||||
0 => [
|
||||
'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' => 'Testing',
|
||||
'packaging_height' => '123',
|
||||
'packaging_width' => '123',
|
||||
'packaging_depth' => '123',
|
||||
'packaging_gross' => '123',
|
||||
'packaging_nett' => '123',
|
||||
],
|
||||
]
|
||||
|
||||
]);
|
||||
|
||||
|
||||
@@ -14,28 +14,24 @@ use Artisan;
|
||||
|
||||
class WarehouseReceiveNoteTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
// public function testGET()
|
||||
// {
|
||||
// $response = $this->json('GET', '/api/warehousearr');
|
||||
|
||||
|
||||
// $response->assertStatus(200);
|
||||
|
||||
// }
|
||||
|
||||
public function testPOST()
|
||||
public function setUp()
|
||||
{
|
||||
$response = $this->json('POST', '/api/warehousearr',
|
||||
parent::setUp();
|
||||
Artisan::call('db:seed');
|
||||
|
||||
}
|
||||
|
||||
public function testPUT()
|
||||
{
|
||||
$response = $this->json('PUT', '/api/warehousearr/1',
|
||||
|
||||
[
|
||||
|
||||
'so_id'=> '3',
|
||||
'receive_on'=> '2018-03-01',
|
||||
'transport_company_name'=> 'TEScief',
|
||||
'so_id'=> '99',
|
||||
'receive_on'=> '2018-06-04',
|
||||
'transport_company_name'=> 'TESTTESTabc',
|
||||
'consignment_note_no'=> '3',
|
||||
'warehouse_receive_note_no'=> '3',
|
||||
'receiving_person'=> 'TEST',
|
||||
@@ -43,7 +39,7 @@ class WarehouseReceiveNoteTest extends TestCase
|
||||
'image'=> 'test.jpg',
|
||||
'warehouseitem' => [
|
||||
0 => [
|
||||
'description'=> 'CIEFhuhuuh',
|
||||
'description'=> 'TESTTESTabctest',
|
||||
'nominal_ctn'=> '1',
|
||||
'actual_ctn'=> '1',
|
||||
'nominal_measurement'=> '1',
|
||||
@@ -54,90 +50,34 @@ class WarehouseReceiveNoteTest extends TestCase
|
||||
'isDamaged'=> '1',
|
||||
'status'=> 'ok',
|
||||
'image'=> 'test.jpg',
|
||||
'wa_id'=> '11',
|
||||
],
|
||||
1 => [
|
||||
'description'=> 'CIE',
|
||||
'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',
|
||||
'wa_id'=> '11',
|
||||
]
|
||||
]
|
||||
]);
|
||||
|
||||
// dd($response->getContent());
|
||||
$response->assertStatus(201);
|
||||
|
||||
$response->assertStatus(201);
|
||||
|
||||
}
|
||||
|
||||
// public function testPUT()
|
||||
// {
|
||||
// $response = $this->json('PUT', '/api/warehousearr/30',
|
||||
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);
|
||||
}
|
||||
|
||||
// 'so_id'=> '3',
|
||||
// 'receive_on'=> '2018-03-01',
|
||||
// 'transport_company_name'=> 'TEScief',
|
||||
// 'consignment_note_no'=> '3',
|
||||
// 'warehouse_receive_note_no'=> '3',
|
||||
// 'receiving_person'=> 'TEST',
|
||||
// 'marking_number'=> '3',
|
||||
// 'image'=> 'test.jpg',
|
||||
// 'warehouseitem' => [
|
||||
// 0 => [
|
||||
// 'description'=> 'CIEFhuhuuh',
|
||||
// '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',
|
||||
// 'wa_id'=> '4',
|
||||
// 'soitem_id'=> '4'
|
||||
// ],
|
||||
// ]
|
||||
// ]);
|
||||
|
||||
// // dd($response->getContent());
|
||||
// $response->assertStatus(201);
|
||||
|
||||
// }
|
||||
|
||||
// public function testUploadWarehouseImage()
|
||||
// {
|
||||
// Storage::fake('warehouse_picture');
|
||||
public function testUploadWarehouseItemImage()
|
||||
{
|
||||
Storage::fake('warehouse_item_picture');
|
||||
|
||||
// $response = $this->actingAs($this->user)
|
||||
// ->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);
|
||||
// }
|
||||
$response = $this->json('POST', '/api/warehousearr/warehouse_item_picture/1', [
|
||||
'warehouse_item_picture' => UploadedFile::fake()->image('test.jpg')
|
||||
]);
|
||||
|
||||
$response->assertStatus(201);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user