write test for permission controller

This commit is contained in:
2025-03-11 11:47:43 +03:30
parent f394f9cd0c
commit 6ec1f6c2b4
9 changed files with 375 additions and 17 deletions

View File

@@ -33,16 +33,14 @@ class SendRoadObservationToNikarayanCommand extends Command
$this->info("Dispatching jobs with a delay between each...");
DB::transaction(function () use (&$count) {
$delay = 0;
RoadObserved::query()
->whereBetween('StartTime_DateTime_fa', ['1403-01-01 00:00:00', '1403-07-13 23:59:59'])
->chunkById(50, function ($roads) use (&$delay, &$count) {
->chunkById(50, function ($roads) use (&$count) {
foreach ($roads as $road) {
$road->update(['status' => 1]);
SendRoadObservationToNikarayan::dispatch($road)->delay(now()->addSeconds($delay));
Log::channel('road_observation_problem')->info("Job for Road Observed ID {$road->id} scheduled with a {$delay} seconds delay.");
$this->info("Scheduled job for Road ID: {$road->id} {$delay}s");
$delay += 3;
SendRoadObservationToNikarayan::dispatch($road);
Log::channel('road_observation_problem')->info("Job for Road Observed ID {$road->id} scheduled.");
$this->info("Scheduled job for Road ID: {$road->id}");
$count +=1;
}
});

View File

@@ -45,12 +45,14 @@ class SendRoadObservationToNikarayan implements ShouldQueue
);
$soapClient = new SoapClient($url);
$soapClient->UpdateInfo_RoadObservedProblems($array);
$result = $soapClient->UpdateInfo_RoadObservedProblems($array);
Log::channel('road_observation_problem')->info(json_encode($result), [$this->roadObserved->id]);
}
catch (\Exception $exception){
Log::channel('road_observation_problem')->error($exception->getMessage(), [
'roadObserved' => $this->roadObserved,
'roadObserved' => $this->roadObserved->id,
'line' => $exception->getLine(),
'file' => $exception->getFile(),
]);
}
}

View File

@@ -33,7 +33,7 @@ class NikarayanService
$soapClient = new SoapClient($url);
$result = $soapClient->UpdateInfo_RoadObservedProblems($array);
Log::channel('nikarayan')->info($result);
Log::channel('nikarayan')->info(json_encode($result));
return $result;
}