ajun 5 éve
szülő
commit
dad6cec942
1 módosított fájl, 16 hozzáadás és 16 törlés
  1. 16 16
      tests/Services/CacheShelfService/ProcessTest.php

+ 16 - 16
tests/Services/CacheShelfService/ProcessTest.php

@@ -102,22 +102,22 @@ class ProcessTest extends TestCase
 
     protected function tearDown(): void
     {
-//        $station = Station::query()->with('parent')->where('code',$this->data['localCode'])->first();
-//        $materialBox = MaterialBox::query()->where('code',$this->data['boxCode'])->first();
-//        if($materialBox){
-//            $StationTaskMaterialBoxes = StationTaskMaterialBox::query()->where('material_box_id',$materialBox['id'])->get();
-//            foreach ($StationTaskMaterialBoxes as $stationTaskMaterialBox) {
-//                if($stationTaskMaterialBox->stationTask) {
-//                    StationTaskChildren::query()->where('station_task_id',$stationTaskMaterialBox->stationTask['id'])->delete();
-//                    $stationTaskMaterialBox->stationTask ? $stationTaskMaterialBox->stationTask->delete() : null;
-//                }
-//                $stationTaskMaterialBox->delete();
-//            }
-//        }
-//        if($station){
-//            $station->parent->delete();
-//            $station->delete();
-//        }
+        $station = Station::query()->with('parent')->where('code',$this->data['localCode'])->first();
+        $materialBox = MaterialBox::query()->where('code',$this->data['boxCode'])->first();
+        if($materialBox){
+            $StationTaskMaterialBoxes = StationTaskMaterialBox::query()->where('material_box_id',$materialBox['id'])->get();
+            foreach ($StationTaskMaterialBoxes as $stationTaskMaterialBox) {
+                if($stationTaskMaterialBox->stationTask) {
+                    StationTaskChildren::query()->where('station_task_id',$stationTaskMaterialBox->stationTask['id'])->delete();
+                    $stationTaskMaterialBox->stationTask ? $stationTaskMaterialBox->stationTask->delete() : null;
+                }
+                $stationTaskMaterialBox->delete();
+            }
+        }
+        if($station){
+            $station->parent->delete();
+            $station->delete();
+        }
         parent::tearDown(); // TODO: Change the autogenerated stub
     }