mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-19 04:24:01 +00:00
ongoing testing
This commit is contained in:
@@ -11,13 +11,13 @@ use App\So;
|
|||||||
class ShipmentarrangementController extends Controller
|
class ShipmentarrangementController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a index of the shipment arrangement
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
//
|
return view('welcome');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,19 +48,19 @@ class ShipmentarrangementController extends Controller
|
|||||||
$shipment->contact_person = $request->input('contact_person');
|
$shipment->contact_person = $request->input('contact_person');
|
||||||
$shipment->remark = $request->input('remark');
|
$shipment->remark = $request->input('remark');
|
||||||
$shipment->so_id = $request->input('so_id');
|
$shipment->so_id = $request->input('so_id');
|
||||||
$shipment->com_id = $request->input('com_id');
|
$shipment->com_id = $Auth::user()->company()->id;
|
||||||
$shipment->save();
|
$shipment->save();
|
||||||
|
|
||||||
//shipment item arrangement checkboxes
|
//shipment item arrangement checkboxes
|
||||||
//id=si1,si2,si3....
|
//id=si1,si2,si3....
|
||||||
//name=shipmentbox[]
|
//name=shipmentbox[]
|
||||||
$shipmentitems = $request->input('shipmentitem');
|
// $shipmentitems = $request->input('shipmentitem');
|
||||||
foreach ($shipmentitems as $shipmentitem)
|
// foreach ($shipmentitems as $shipmentitem)
|
||||||
{
|
// {
|
||||||
$new_shipmentitem = new Shipmentitem;
|
// $new_shipmentitem = new Shipmentitem;
|
||||||
$new_shipmentitem->shipmentbox = $shipmentitem;
|
// $new_shipmentitem->shipmentbox = $shipmentitem;
|
||||||
$new_shipmentitem->save();
|
// $new_shipmentitem->save();
|
||||||
}
|
// }
|
||||||
|
|
||||||
return response()->json(['shipment'=>$shipment], 201);
|
return response()->json(['shipment'=>$shipment], 201);
|
||||||
|
|
||||||
@@ -141,15 +141,15 @@ class ShipmentarrangementController extends Controller
|
|||||||
$shipment->save();
|
$shipment->save();
|
||||||
|
|
||||||
|
|
||||||
$shipmentitems = $request->input('shipmentitem');
|
// $shipmentitems = $request->input('shipmentitem');
|
||||||
foreach ($shipmentitems as $shipmentitem)
|
// foreach ($shipmentitems as $shipmentitem)
|
||||||
{
|
// {
|
||||||
$ex_shipmentitem = shipmentitem::where('sa_id', $id)->first();
|
// $ex_shipmentitem = shipmentitem::where('sa_id', $id)->get();
|
||||||
$ex_shipmentitem = new Shipmentitem;
|
// $ex_shipmentitem = new Shipmentitem;
|
||||||
$ex_shipmentitem->shipmentbox = $shipmentitem;
|
// $ex_shipmentitem->shipmentbox = $shipmentitem;
|
||||||
$ex_shipmentitem->save();
|
// $ex_shipmentitem->save();
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
return response()->json(['shipment'=>$shipment], 201);
|
return response()->json(['shipment'=>$shipment], 201);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,62 +0,0 @@
|
|||||||
<?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',
|
|
||||||
]
|
|
||||||
]
|
|
||||||
];
|
|
||||||
});
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use App\Company;
|
||||||
|
|
||||||
|
class CompanySeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
DB::table('companies')->insert([
|
||||||
|
|
||||||
|
'id'=> '1',
|
||||||
|
'company_name'=>'testing',
|
||||||
|
'registration_no'=>'testing',
|
||||||
|
'tax_no'=>'testing',
|
||||||
|
'tel_no'=>'12345',
|
||||||
|
'fax'=>'12345',
|
||||||
|
'address'=>'testing',
|
||||||
|
'city'=>'testing',
|
||||||
|
'postcode'=>'1234',
|
||||||
|
'state'=>'testing',
|
||||||
|
'country'=>'testing',
|
||||||
|
'contact_person'=>'testing',
|
||||||
|
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||||
|
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||||
|
'user_id'=>'2',
|
||||||
|
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
|
class CustomexamSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
DB::table('customexam')->insert([
|
||||||
|
|
||||||
|
'id' => '1',
|
||||||
|
'so_id' => '1',
|
||||||
|
'custom_date' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||||
|
'new_etd' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||||
|
'new_eta' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||||
|
'release_date' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||||
|
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||||
|
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||||
|
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,5 +17,7 @@ class DatabaseSeeder extends Seeder
|
|||||||
$this->call(SoitemSeeder::class);
|
$this->call(SoitemSeeder::class);
|
||||||
$this->call(WarehousearrSeeder::class);
|
$this->call(WarehousearrSeeder::class);
|
||||||
$this->call(WarehouseitemSeeder::class);
|
$this->call(WarehouseitemSeeder::class);
|
||||||
|
$this->call(ShipmentArrangementSeeder::class);
|
||||||
|
$this->call(CustomexamSeeder::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use Carbon\Carbon;
|
||||||
|
use App\Shipment;
|
||||||
|
|
||||||
|
class ShipmentArrangementSeeder extends Seeder
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the database seeds.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
DB::table('shipments')->insert([
|
||||||
|
|
||||||
|
'loading_date'=> Carbon::now()->format('Y-m-d H:i:s'),
|
||||||
|
'shipment_no'=> '123213',
|
||||||
|
'departure_port'=> 'TEST',
|
||||||
|
'container_no'=> '12312',
|
||||||
|
'type_of_container'=> 'TEST',
|
||||||
|
'last_etd'=> Carbon::now()->format('Y-m-d H:i:s'),
|
||||||
|
'last_eta'=> Carbon::now()->format('Y-m-d H:i:s'),
|
||||||
|
'driver_name'=> 'TEST',
|
||||||
|
'driver_contact_no'=> '1213',
|
||||||
|
'trailer_no'=> '12324',
|
||||||
|
'driver_ic_no'=> '12345',
|
||||||
|
'loading_address'=> 'TEST',
|
||||||
|
'loading_city'=> 'TEST',
|
||||||
|
'loading_state'=> 'TEST',
|
||||||
|
'contact_no'=> '12345',
|
||||||
|
'country'=> 'TEST',
|
||||||
|
'contact_person'=> 'TEST',
|
||||||
|
'remark'=> 'TEST',
|
||||||
|
'so_id'=> '1',
|
||||||
|
'com_id'=> '1',
|
||||||
|
'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||||
|
'updated_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
||||||
|
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,7 +15,6 @@ class SoSeeder extends Seeder
|
|||||||
{
|
{
|
||||||
DB::table('sos')->insert([
|
DB::table('sos')->insert([
|
||||||
|
|
||||||
'id' => '1',
|
|
||||||
'ff_id' => '1',
|
'ff_id' => '1',
|
||||||
'supplier_company_name' => 'SEED',
|
'supplier_company_name' => 'SEED',
|
||||||
'supplier_contact_person' => 'SEED',
|
'supplier_contact_person' => 'SEED',
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class WarehousearrSeeder extends Seeder
|
|||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
DB::table('warehousearrs')->insert([
|
DB::table('warehousearrs')->insert([
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -41,9 +41,9 @@ Route::post('/decision/decisionitem','WarehousearrangementController@storedecisi
|
|||||||
/* Shipment-arrangement */
|
/* Shipment-arrangement */
|
||||||
Route::get('/shipment','ShipmentarrangementController@index');//view the shipment
|
Route::get('/shipment','ShipmentarrangementController@index');//view the shipment
|
||||||
Route::post('/shipment','ShipmentarrangementController@store');//post the shipment
|
Route::post('/shipment','ShipmentarrangementController@store');//post the shipment
|
||||||
//update shipment??
|
Route::put('/shipment/{sa_id}','ShipmentarrangementController@update');//update shipment //update shipment??
|
||||||
Route::post('/custom-exam','ShipmentarrangementController@customStore');;//post the custom-examintion
|
Route::post('/custom-exam','ShipmentarrangementController@customStore');;//post the custom-examintion
|
||||||
Route::put('/custom-exam','ShipmentarrangementController@customUpdate');//update the custom-examintion
|
Route::put('/custom-exam/{id}','ShipmentarrangementController@customUpdate');//update the custom-examintion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class CompanyTest extends TestCase
|
|||||||
protected $company;
|
protected $company;
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
Artisan::call('db:seed');
|
Artisan::call('db:seed');
|
||||||
|
|||||||
@@ -0,0 +1,111 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Unit;
|
||||||
|
|
||||||
|
use Tests\TestCase;
|
||||||
|
use Illuminate\Foundation\Testing\WithFaker;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use App\Shipment;
|
||||||
|
use App\Shipmentitem;
|
||||||
|
use App\Customexam;
|
||||||
|
use Artisan;
|
||||||
|
|
||||||
|
class ShipmentArrangementTest extends TestCase
|
||||||
|
{
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
Artisan::call('db:seed');
|
||||||
|
$this->user = factory(User::class)->create();
|
||||||
|
$this->company = $this->user->each(function ($u) {
|
||||||
|
factory(Company::class)->create([
|
||||||
|
'user_id' => $u->id,
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// public function testPOST()
|
||||||
|
// {
|
||||||
|
// $response = $this->json('POST', '/api/shipment',
|
||||||
|
|
||||||
|
// [
|
||||||
|
|
||||||
|
// 'loading_date'=> '2018-06-05',
|
||||||
|
// 'shipment_no'=> '123213',
|
||||||
|
// 'departure_port'=> 'TEST',
|
||||||
|
// 'container_no'=> '12312',
|
||||||
|
// 'type_of_container'=> 'TEST',
|
||||||
|
// 'last_etd'=> '2018-06-05',
|
||||||
|
// 'last_eta'=> '2018-06-05',
|
||||||
|
// 'driver_name'=> 'TEST',
|
||||||
|
// 'driver_contact_no'=> '1213',
|
||||||
|
// 'trailer_no'=> '12324',
|
||||||
|
// 'driver_ic_no'=> '12345',
|
||||||
|
// 'loading_address'=> 'TEST',
|
||||||
|
// 'loading_city'=> 'TEST',
|
||||||
|
// 'loading_state'=> 'TEST',
|
||||||
|
// 'contact_no'=> '12345',
|
||||||
|
// 'country'=> 'TEST',
|
||||||
|
// 'contact_person'=> 'TEST',
|
||||||
|
// 'remark'=> 'TEST',
|
||||||
|
// 'so_id'=> '1',
|
||||||
|
// 'com_id'=> '1',
|
||||||
|
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $response->assertStatus(201);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// public function testPUT()
|
||||||
|
// {
|
||||||
|
// $response = $this->json('PUT', '/api/shipment/1',
|
||||||
|
|
||||||
|
// [
|
||||||
|
|
||||||
|
// 'loading_date'=> '2018-06-05',
|
||||||
|
// 'shipment_no'=> '123213',
|
||||||
|
// 'departure_port'=> 'TEST',
|
||||||
|
// 'container_no'=> '12312',
|
||||||
|
// 'type_of_container'=> 'TEST',
|
||||||
|
// 'last_etd'=> '2018-06-05',
|
||||||
|
// 'last_eta'=> '2018-06-05',
|
||||||
|
// 'driver_name'=> 'TEST',
|
||||||
|
// 'driver_contact_no'=> '1213',
|
||||||
|
// 'trailer_no'=> '12324',
|
||||||
|
// 'driver_ic_no'=> '12345',
|
||||||
|
// 'loading_address'=> 'TEST',
|
||||||
|
// 'loading_city'=> 'TEST',
|
||||||
|
// 'loading_state'=> 'TEST',
|
||||||
|
// 'contact_no'=> '12345',
|
||||||
|
// 'country'=> 'TEST',
|
||||||
|
// 'contact_person'=> 'TEST',
|
||||||
|
// 'remark'=> 'TEST',
|
||||||
|
// 'so_id'=> '1',
|
||||||
|
// 'com_id'=> '1',
|
||||||
|
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $response->assertStatus(201);
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public function testPUTcustom()
|
||||||
|
// {
|
||||||
|
// $response = $this->json('PUT', '/api/custom/1',
|
||||||
|
|
||||||
|
// [
|
||||||
|
// 'so_id' => '1',
|
||||||
|
// 'custom_date' => '2018-06-05',
|
||||||
|
// 'new_etd' => '2018-06-05',
|
||||||
|
// 'new_eta' => '2018-06-05',
|
||||||
|
// 'release_date' => '2018-06-05',
|
||||||
|
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
// $response->assertStatus(201);
|
||||||
|
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -14,7 +14,6 @@ use Artisan;
|
|||||||
|
|
||||||
class WarehouseReceiveNoteTest extends TestCase
|
class WarehouseReceiveNoteTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
@@ -29,7 +28,7 @@ class WarehouseReceiveNoteTest extends TestCase
|
|||||||
|
|
||||||
[
|
[
|
||||||
|
|
||||||
'so_id'=> '99',
|
'so_id'=> '1',
|
||||||
'receive_on'=> '2018-06-04',
|
'receive_on'=> '2018-06-04',
|
||||||
'transport_company_name'=> 'TESTTESTabc',
|
'transport_company_name'=> 'TESTTESTabc',
|
||||||
'consignment_note_no'=> '3',
|
'consignment_note_no'=> '3',
|
||||||
|
|||||||
Reference in New Issue
Block a user