|
|
@@ -0,0 +1,62 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+
|
|
|
+namespace Tests\Services\ForeignHaiRoboticsService;
|
|
|
+
|
|
|
+use App\Exceptions\ErrorException;
|
|
|
+use App\MaterialBox;
|
|
|
+use App\Services\ForeignHaiRoboticsService;
|
|
|
+use App\Services\StationService;
|
|
|
+use App\Station;
|
|
|
+use App\StationCacheShelfGrid;
|
|
|
+use App\StationTaskMaterialBox;
|
|
|
+use App\Traits\TestMockSubServices;
|
|
|
+use Tests\TestCase;
|
|
|
+
|
|
|
+class PutBinToStoreFromCacheShelfTest extends TestCase
|
|
|
+{
|
|
|
+ use TestMockSubServices;
|
|
|
+
|
|
|
+ /** @var ForeignHaiRoboticsService $service */
|
|
|
+ protected $service;
|
|
|
+ protected $data = [];
|
|
|
+
|
|
|
+ protected function setUp(): void
|
|
|
+ {
|
|
|
+ parent::setUp();
|
|
|
+ $this->service = $this->subMock([
|
|
|
+ 'class' => ForeignHaiRoboticsService::class,
|
|
|
+ 'subService' => [
|
|
|
+ 'serviceName' => 'StationService',
|
|
|
+ 'class' => StationService::class,
|
|
|
+ 'methods' => [
|
|
|
+ 'controlHaiRobot' => true
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ ]);
|
|
|
+ $this->data['station'] = factory(Station::class)->create();
|
|
|
+ $this->data['materialBox'] = factory(MaterialBox::class)->create();
|
|
|
+ $this->data['grids'] = factory(StationCacheShelfGrid::class)->create();
|
|
|
+ $this->data['stationTaskMaterialBox'] = factory(StationTaskMaterialBox::class)
|
|
|
+ ->create(['station_id'=>$this->data['station']['id']]);
|
|
|
+ $this->data['station']->setRelation('grids',collect([$this->data['grids']]));
|
|
|
+ $this->data['stationTaskMaterialBox']->setRelation('station', $this->data['station']);
|
|
|
+ $this->data['stationTaskMaterialBox']->setRelation('materialBox', $this->data['materialBox']);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function testSuccess1()
|
|
|
+ {
|
|
|
+ $success = $this->service->putBinToStore_fromCacheShelf($this->data['stationTaskMaterialBox']);
|
|
|
+ $this->assertEquals($success,true);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ protected function tearDown(): void
|
|
|
+ {
|
|
|
+ Station::query()->where('id',$this->data['station']['id'])->delete();
|
|
|
+ StationCacheShelfGrid::query()->where('id',$this->data['grids']['id'])->delete();
|
|
|
+ MaterialBox::query()->where('id',$this->data['materialBox']['id'])->delete();
|
|
|
+ StationTaskMaterialBox::query()->where('id',$this->data['stationTaskMaterialBox']['id'])->delete();
|
|
|
+ parent::tearDown();
|
|
|
+ }
|
|
|
+}
|