WaybillTest.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace Tests\Feature;
  3. use App\WaybillPriceModel;
  4. use App\User;
  5. use App\Waybill;
  6. use App\WaybillPayoff;
  7. use Illuminate\Support\Facades\Auth;
  8. use Illuminate\Support\Facades\Request;
  9. use phpDocumentor\Reflection\Types\This;
  10. use Tests\TestCase;
  11. use Illuminate\Foundation\Testing\WithFaker;
  12. use Illuminate\Foundation\Testing\RefreshDatabase;
  13. class WaybillTest extends TestCase
  14. {
  15. use RefreshDatabase;
  16. protected $id;
  17. public function testAddWaybill(){
  18. $waybill=new Waybill([
  19. 'type'=>'直发车',
  20. 'waybill_number'=>'BSZX19112530861455654',
  21. 'owner_id'=>1,
  22. 'wms_bill_number'=>'201900202455165454',
  23. 'origination'=>'上海松江泗泾交科松江科创园',
  24. 'destination'=>'北京',
  25. 'recipient'=>'陈某',
  26. 'recipient_mobile'=>'12345628915',
  27. 'charge'=>285.2,
  28. 'ordering_remark'=>'测试',
  29. 'carrier_id'=>1,
  30. 'carrier_bill'=>'254785852154452',
  31. 'origination_city_id'=>1,
  32. 'destination_city_id'=>1,
  33. 'warehouse_weight'=>2058.2,
  34. 'warehouse_weight_unit_id'=>1,
  35. 'carrier_weight'=>2058,
  36. 'carrier_weight_unit_id'=>1,
  37. 'carType_id'=>1,
  38. 'fee'=>2223,
  39. 'pick_up_fee'=>44445,
  40. 'other_fee'=>200,
  41. 'collect_fee'=>558,
  42. 'dispatch_remark'=>'调度测试'
  43. ]);
  44. $waybill->save();
  45. $this->assertNotEmpty($waybill);
  46. $this->id=$waybill->id;
  47. return $waybill;
  48. }
  49. public function tearDown(): void
  50. {
  51. $this->assertTrue(Waybill::find($this->id)->delete());
  52. parent::tearDown(); // TODO: Change the autogenerated stub
  53. }
  54. }