mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim-api.git
synced 2026-08-22 05:54:18 +00:00
testing
This commit is contained in:
@@ -9,7 +9,6 @@ use App\Warehouseitem;
|
||||
use App\Decision;
|
||||
use App\Decisionitem;
|
||||
use Validator;
|
||||
use DB;
|
||||
|
||||
class WarehousearrangementController extends Controller
|
||||
{
|
||||
@@ -43,7 +42,7 @@ class WarehousearrangementController extends Controller
|
||||
$warehousearr->image = $request->input('image');
|
||||
$warehousearr->save();
|
||||
|
||||
//store warehouse receive note item
|
||||
//store warehouse receive note item
|
||||
$warehouseitems = $request->input("warehouseitem");
|
||||
foreach ($warehouseitems as $warehouseitem)
|
||||
{
|
||||
@@ -99,7 +98,6 @@ class WarehousearrangementController extends Controller
|
||||
foreach ($warehouseitems as $warehouseitem)
|
||||
{
|
||||
$ex_warehouseitem = Warehouseitem::where('wa_id', $id)->first();
|
||||
//return $ex_warehouseitem;
|
||||
|
||||
$ex_warehouseitem->description = $warehouseitem['description'];
|
||||
$ex_warehouseitem->nominal_ctn = $warehouseitem['nominal_ctn'];
|
||||
@@ -245,7 +243,6 @@ class WarehousearrangementController extends Controller
|
||||
return response()->json(['decisionitem'=>$decisionitem], 201);
|
||||
|
||||
}
|
||||
//need to do the put, delete, for the all post
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class DropForeignKeyInWarehouseitemsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('warehouseitems', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('warehouseitems', function (Blueprint $table) {
|
||||
|
||||
// $table->dropColumn('soitem_id');
|
||||
// $table->dropForeign('warehouseitems_soitem_id_foreign');
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -15,7 +15,7 @@ use Illuminate\Http\Request;
|
||||
|
||||
//route for the Warehouse-receive-note
|
||||
//Route::get('/so/{so_id}','warehousearrangementController@index');//view the list of wrn
|
||||
Route::get('/warehousearr/{wa_id}','WarehousearrangementController@index');//view the wrn
|
||||
Route::get('/warehousearr','WarehousearrangementController@index');//view the wrn
|
||||
|
||||
Route::post('/warehousearr','WarehousearrangementController@store');//store the new wrn
|
||||
Route::post('/warehousearr/warehouse_picture/{wa_id}','WarehousearrangementController@warehousearrpic');//upload warehousepicture picture
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBasicTest()
|
||||
{
|
||||
$response = $this->get('/');
|
||||
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use Tests\TestCase;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBasicTest()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
<?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;
|
||||
|
||||
|
||||
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()
|
||||
{
|
||||
$response = $this->json('POST', '/api/warehousearr',
|
||||
|
||||
[
|
||||
|
||||
'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'
|
||||
],
|
||||
1 => [
|
||||
'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'
|
||||
]
|
||||
]
|
||||
]);
|
||||
|
||||
$response->assertStatus(201);
|
||||
|
||||
}
|
||||
|
||||
// public function testUploadWarehouseImage()
|
||||
// {
|
||||
// Storage::fake('warehouse_picture');
|
||||
|
||||
// $response = $this->actingAs($this->user)
|
||||
// ->json('POST', '/warehousearr/warehouse_picture/{wa_id}', [
|
||||
// 'warehouse_picture' => UploadedFile::fake()->image('comp.jpg')
|
||||
// ]);
|
||||
// // dd($response->getContent());
|
||||
// $response->assertStatus(201);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user