cacheShelfService = app(CacheShelfService::class); // $this->stationTaskMaterialBoxService = app(StationTaskMaterialBoxService::class); // $stationType = StationType::query()->firstOrCreate(['name' => '缓存架']); // $this->data['materialBox'] = factory(MaterialBox::class)->create(); // // $this->data['parentStation'] = factory(Station::class)->create([ 'station_type_id' => $stationType['id']]); // $this->data['station'] = factory(Station::class)->create([ 'station_type_id' => $stationType['id'], 'parent_id' => $this->data['parentStation']['id']]); // $this->data['stationTask'] = factory(StationTask::class)->create(['station_id' => $this->data['station']['id'], 'status' => '处理中']); // $this->data['takeStationTaskMaterialBox'] = $this->stationTaskMaterialBoxService->createByStationAndMaterialBox($this->data['station'], $this->data['materialBox']); // $this->data['putStationTaskMaterialBox'] = $this->stationTaskMaterialBoxService->createByStationAndMaterialBox($this->data['station'], $this->data['materialBox']); } public function testPutStationTaskMaterialBoxProcess() { // $this->data['takeStationTaskMaterialBox']->update(['status' => '处理中']); // $this->cacheShelfService->putStationTaskMaterialBoxProcess($this->data['putStationTaskMaterialBox']); // $task = StationTaskMaterialBox::query()->where('id', $this->data['takeStationTaskMaterialBox']['id'])->first(); // $this->assertTrue($task ? true : false); // $this->assertEquals( '完成',$task['status']); $this->assertTrue(true); } // public function testPutStationTaskMaterialBoxProcessT() // { // $this->cacheShelfService->putStationTaskMaterialBoxProcess($this->data['putStationTaskMaterialBox']); // $task = StationTaskMaterialBox::query()->where('id', $this->data['takeStationTaskMaterialBox']['id'])->first(); // $this->assertTrue($task ? true : false); // $this->assertNotEquals('完成',$task['status']); // } protected function tearDown(): void { // if ($this->data['materialBox']) MaterialBox::query()->where('id', $this->data['materialBox']['id'])->delete(); // if ($this->data['parentStation']) Station::query()->where('id', $this->data['parentStation']['id'])->delete(); // if ($this->data['station']) Station::query()->where('id', $this->data['station']['id'])->delete(); // if ($this->data['stationTask']) StationTask::query()->where('id', $this->data['stationTask']['id'])->delete(); // if ($this->data['takeStationTaskMaterialBox']) StationTaskMaterialBox::query()->where('id', $this->data['takeStationTaskMaterialBox']['id'])->delete(); // if ($this->data['putStationTaskMaterialBox']) StationTaskMaterialBox::query()->where('id', $this->data['putStationTaskMaterialBox']['id'])->delete(); parent::tearDown(); } }