CreateOrFindOrderInfoTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace Tests\Services\OrderService;
  3. use App\OracleDOCOrderHeader;
  4. use App\Order;
  5. use App\Owner;
  6. use App\Services\OrderService;
  7. use Carbon\Carbon;
  8. use Illuminate\Foundation\Testing\RefreshDatabase;
  9. use Illuminate\Foundation\Testing\WithFaker;
  10. use Illuminate\Support\Str;
  11. use Tests\TestCase;
  12. class CreateOrFindOrderInfoTest extends TestCase
  13. {
  14. /**
  15. * @var OrderService $orderService
  16. */
  17. public $orderService;
  18. public $data = [];
  19. public $order ;
  20. public function setUp(): void
  21. {
  22. parent::setUp(); // TODO: Change the autogenerated stub
  23. $this->orderService = app('OrderService');
  24. $this->data['orderHeader'] = OracleDOCOrderHeader::query()->orderBy('addTime')->first();
  25. }
  26. public function testCreateOrFindOrderInfo()
  27. {
  28. $this->orderService->createOrFindOrderInfo($this->data['orderHeader']);
  29. $order =Order::query()->where('code',$this->data['orderHeader']['orderno'])->first();
  30. $this->assertNotNull($order);
  31. $this->order = $order;
  32. $this->assertEquals($order->code,$this->data['orderHeader']['orderno']);
  33. $this->order->delete();
  34. }
  35. }