<?php

namespace Tests\Feature;

use App\WaybillPriceModel;
use App\User;
use App\Waybill;
use App\WaybillPayoff;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Request;
use phpDocumentor\Reflection\Types\This;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithFaker;
use Illuminate\Foundation\Testing\RefreshDatabase;

class WaybillTest extends TestCase
{
    use RefreshDatabase;

        protected $id;

        public  function testAddWaybill(){
            $waybill=new  Waybill([
                'type'=>'直发车',
                'waybill_number'=>'BSZX19112530861455654',
                'owner_id'=>1,
                'wms_bill_number'=>'201900202455165454',
                'origination'=>'上海松江泗泾交科松江科创园',
                'destination'=>'北京',
                'recipient'=>'陈某',
                'recipient_mobile'=>'12345628915',
                'charge'=>285.2,
                'ordering_remark'=>'测试',
                'carrier_id'=>1,
                'carrier_bill'=>'254785852154452',
                'origination_city_id'=>1,
                'destination_city_id'=>1,
                'warehouse_weight'=>2058.2,
                'warehouse_weight_unit_id'=>1,
                'carrier_weight'=>2058,
                'carrier_weight_unit_id'=>1,
                'carType_id'=>1,
                'fee'=>2223,
                'pick_up_fee'=>44445,
                'other_fee'=>200,
                'collect_fee'=>558,
                'dispatch_remark'=>'调度测试'
            ]);
            $waybill->save();
            $this->assertNotEmpty($waybill);
            $this->id=$waybill->id;
            return $waybill;
        }


    public function tearDown(): void
    {
        $this->assertTrue(Waybill::find($this->id)->delete());
        parent::tearDown(); // TODO: Change the autogenerated stub
    }

}
