PutStationTaskMaterialBoxProcessTest.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace Tests\Services\CacheShelfService;
  3. use App\MaterialBox;
  4. use App\Services\CacheService;
  5. use App\Services\CacheShelfService;
  6. use App\Services\StationTaskMaterialBoxService;
  7. use App\Station;
  8. use App\StationTask;
  9. use App\StationTaskMaterialBox;
  10. use App\StationType;
  11. use Tests\TestCase;
  12. class PutStationTaskMaterialBoxProcessTest extends TestCase
  13. {
  14. /** @var CacheShelfService $cacheShelfService */
  15. private $cacheShelfService;
  16. /** @var StationTaskMaterialBoxService $stationTaskMaterialBoxService */
  17. private $stationTaskMaterialBoxService;
  18. private $data = [];
  19. protected function setUp(): void
  20. {
  21. parent::setUp(); // TODO: Change the autogenerated stub
  22. // $this->cacheShelfService = app(CacheShelfService::class);
  23. // $this->stationTaskMaterialBoxService = app(StationTaskMaterialBoxService::class);
  24. // $stationType = StationType::query()->firstOrCreate(['name' => '缓存架']);
  25. // $this->data['materialBox'] = factory(MaterialBox::class)->create();
  26. //
  27. // $this->data['parentStation'] = factory(Station::class)->create([ 'station_type_id' => $stationType['id']]);
  28. // $this->data['station'] = factory(Station::class)->create([ 'station_type_id' => $stationType['id'], 'parent_id' => $this->data['parentStation']['id']]);
  29. // $this->data['stationTask'] = factory(StationTask::class)->create(['station_id' => $this->data['station']['id'], 'status' => '处理中']);
  30. // $this->data['takeStationTaskMaterialBox'] = $this->stationTaskMaterialBoxService->createByStationAndMaterialBox($this->data['station'], $this->data['materialBox']);
  31. // $this->data['putStationTaskMaterialBox'] = $this->stationTaskMaterialBoxService->createByStationAndMaterialBox($this->data['station'], $this->data['materialBox']);
  32. }
  33. public function testPutStationTaskMaterialBoxProcess()
  34. {
  35. // $this->data['takeStationTaskMaterialBox']->update(['status' => '处理中']);
  36. // $this->cacheShelfService->putStationTaskMaterialBoxProcess($this->data['putStationTaskMaterialBox']);
  37. // $task = StationTaskMaterialBox::query()->where('id', $this->data['takeStationTaskMaterialBox']['id'])->first();
  38. // $this->assertTrue($task ? true : false);
  39. // $this->assertEquals( '完成',$task['status']);
  40. $this->assertTrue(true);
  41. }
  42. // public function testPutStationTaskMaterialBoxProcessT()
  43. // {
  44. // $this->cacheShelfService->putStationTaskMaterialBoxProcess($this->data['putStationTaskMaterialBox']);
  45. // $task = StationTaskMaterialBox::query()->where('id', $this->data['takeStationTaskMaterialBox']['id'])->first();
  46. // $this->assertTrue($task ? true : false);
  47. // $this->assertNotEquals('完成',$task['status']);
  48. // }
  49. protected function tearDown(): void
  50. {
  51. // if ($this->data['materialBox']) MaterialBox::query()->where('id', $this->data['materialBox']['id'])->delete();
  52. // if ($this->data['parentStation']) Station::query()->where('id', $this->data['parentStation']['id'])->delete();
  53. // if ($this->data['station']) Station::query()->where('id', $this->data['station']['id'])->delete();
  54. // if ($this->data['stationTask']) StationTask::query()->where('id', $this->data['stationTask']['id'])->delete();
  55. // if ($this->data['takeStationTaskMaterialBox']) StationTaskMaterialBox::query()->where('id', $this->data['takeStationTaskMaterialBox']['id'])->delete();
  56. // if ($this->data['putStationTaskMaterialBox']) StationTaskMaterialBox::query()->where('id', $this->data['putStationTaskMaterialBox']['id'])->delete();
  57. parent::tearDown();
  58. }
  59. }