| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- namespace Tests\Services\CacheShelfService;
- use App\MaterialBox;
- use App\Services\CacheShelfService;
- use App\Services\ForeignHaiRoboticsService;
- use App\Services\StationCacheShelfGridService;
- use App\Station;
- use App\StationTask;
- use App\StationTaskChildren;
- use App\StationTaskMaterialBox;
- use App\Traits\TestMockSubServices;
- use Tests\TestCase;
- class PutBinToStoreTest extends TestCase
- {
- use TestMockSubServices;
- /** @var CacheShelfService $cacheShelfService */
- protected $cacheShelfService;
- protected $data = [];
- protected function setup(): void
- {
- parent::setup(); // todo: change the autogenerated stub
- // $this->data['station'] = factory(Station::class)->create(['station_type_id'=>1]);
- // $this->data['materialBox'] = factory(MaterialBox::class)->create();
- // $this->data['stationTask'] = factory(StationTask::class)->create();
- // $this->data['stationTask']['station_id'] = $this->data['station']['id'];
- // $this->data['stationTask']->save();
- //
- // $this->data['stationTaskMaterialBox'] = factory(StationTaskMaterialBox::class)->create([
- // 'station_id' => $this->data['station']['id'],
- // 'material_box_id' => $this->data['materialBox']['id'],
- // 'status' => '待处理'
- // ]);
- //
- // $this->data['stationTaskMaterialBox']['station_task_id'] = $this->data['stationTask']['id'];
- // $this->data['stationTaskMaterialBox']->save();
- //
- // $this->data['stationTaskChildren'] = StationTaskChildren::query()->create([
- // "station_task_id" => $this->data['stationTask']['id'],
- // ]);
- // $this->data['stationTaskChildren']["station_taskable_type"] = StationTaskMaterialBox::class;
- // $this->data['stationTaskChildren']["station_taskable_id"]= $this->data['stationTaskMaterialBox']['id'];
- // $this->data['stationTaskChildren']->save();
- //
- // $this->cacheShelfService = $this->subMock([
- // 'class' => CacheShelfService::class,
- // 'subService' => [
- // [
- // 'serviceName' => 'foreignHaiRoboticsService',
- // 'class' => ForeignHaiRoboticsService::class,
- // 'methods' => [
- // 'controlHaiRobot' => true
- // ]
- // ]
- // ]
- // ]);
- }
- public function testPutBinToStore()
- {
- // $bool = $this->cacheShelfService->putBinToStore($this->data['station']);
- // $boxTask = StationTaskMaterialBox::query()->where('material_box_id', $this->data['materialBox']['id'])->get();
- // $this->assertTrue($bool);
- // $this->assertNotEmpty($boxTask);
- $this->assertTrue(true);
- }
- protected function tearDown(): void
- {
- // StationTaskChildren::query()->where('station_taskable_id',$this->data['stationTaskMaterialBox']['id'])->delete();
- // $materialBox = MaterialBox::query()->where('id', $this->data['materialBox']['id'])->first();
- // if ($materialBox) {
- // $stationTaskMaterialBoxes = StationTaskMaterialBox::query()->where('material_box_id', $materialBox['id'])->get();
- // foreach ($stationTaskMaterialBoxes as $stationTaskMaterialBox) {
- // if ($stationTaskMaterialBox->station) $stationTaskMaterialBox->station->delete();
- // if ($stationTaskMaterialBox->stationTask) $stationTaskMaterialBox->stationTask->delete();
- // $stationTaskMaterialBox->delete();
- // }
- // $materialBox->delete();
- // }
- // if($this->data['stationTaskChildren'])StationTaskChildren::query()->where('id',$this->data['stationTaskChildren']['id'])->delete();
- parent::tearDown();
- }
- }
|