|
|
@@ -6,12 +6,14 @@ use App\Order;
|
|
|
use App\OrderCommodity;
|
|
|
use App\Services\StationTaskCommodityService;
|
|
|
use App\Services\StationTaskService;
|
|
|
+use App\Traits\TestMockSubServices;
|
|
|
use Tests\TestCase;
|
|
|
use App\StationTaskCommodity;
|
|
|
|
|
|
class CreateByBatchesTest extends TestCase
|
|
|
{
|
|
|
|
|
|
+ use TestMockSubServices;
|
|
|
/** @var StationTaskCommodityService $service */
|
|
|
public $service;
|
|
|
/** @var StationTaskService $service */
|
|
|
@@ -38,27 +40,13 @@ class CreateByBatchesTest extends TestCase
|
|
|
$this->orderAmount)
|
|
|
->create([
|
|
|
'status'=>'未处理',
|
|
|
- 'batch_id'=>(function(){
|
|
|
- if(!isset($this->data['temBatchId_orders'])){
|
|
|
- $this->data['temBatchId_orders']=$this->batchAmount;
|
|
|
- }
|
|
|
- $this->data['temBatchId_orders']++;
|
|
|
- if($this->data['temBatchId_orders']>=$this->batchAmount)$this->data['temBatchId_orders']=0;
|
|
|
- return $this->data['batches'][$this->data['temBatchId_orders']];
|
|
|
- })(),
|
|
|
+ 'batch_id'=>$this->getTargetIdCirculately($this->data['batches']),
|
|
|
]);
|
|
|
$this->data['orderCommodities'] =
|
|
|
factory(OrderCommodity::class,
|
|
|
$this->orderCommodityAmount)
|
|
|
->create([
|
|
|
- 'order_id'=>(function(){
|
|
|
- if(!isset($this->data['temOrderId_orderCommodities'])){
|
|
|
- $this->data['temOrderId_orderCommodities']=$this->orderAmount;
|
|
|
- }
|
|
|
- $this->data['temOrderId_orderCommodities']++;
|
|
|
- if($this->data['temOrderId_orderCommodities']>=$this->orderAmount)$this->data['temOrderId_orderCommodities']=0;
|
|
|
- return $this->data['orders'][$this->data['temOrderId_orderCommodities']];
|
|
|
- })(),
|
|
|
+ 'order_id'=>$this->getTargetIdCirculately($this->data['orders']),
|
|
|
]);
|
|
|
}
|
|
|
|