From 5201aa3a5a658ea8e5ca462076d00216c4f10d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Munsch?= Date: Tue, 27 Oct 2026 11:06:25 +0100 Subject: [PATCH] chore(jobs): disable Arcadia jobs until API is available and refresh --- app/Policies/Backend/EmployeePolicy.php | 12 +++++---- bootstrap/jobs.php | 9 ++++--- .../Bo/EmployeesControllerTest.php | 27 ++++++++++--------- .../Bo/Employees/EmployeeSyncFeatureTest.php | 6 +++++ 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/app/Policies/Backend/EmployeePolicy.php b/app/Policies/Backend/EmployeePolicy.php index 0025996f..e8c19be8 100644 --- a/app/Policies/Backend/EmployeePolicy.php +++ b/app/Policies/Backend/EmployeePolicy.php @@ -6,16 +6,18 @@ namespace App\Policies\Backend; use App\Models\Customer; use App\Models\User; -use Domain\Enums\UserRole; class EmployeePolicy { public function dispatchArcadiaRefreshJob(Customer | User $user): bool { - if ($user instanceof Customer) { - return false; - } + // FIXME: The Arcadia refresh job dispatching is currently disabled and needs to be enabled when api will be available. + return false; - return $user->role->isAtLeastEqualsTo(UserRole::Admin); + // if ($user instanceof Customer) { + // return false; + // } + + // return $user->role->isAtLeastEqualsTo(UserRole::Admin); } } diff --git a/bootstrap/jobs.php b/bootstrap/jobs.php index 83843136..f83dddf0 100644 --- a/bootstrap/jobs.php +++ b/bootstrap/jobs.php @@ -3,8 +3,6 @@ declare(strict_types=1); use App\Jobs\DeleteOldResetTokens; -use App\Jobs\FetchAndUpsertArcadiaEmployees; -use App\Jobs\FetchAndUpsertArcadiaProductIncos; use App\Jobs\SendMissingOrderReminderJob; use App\Jobs\SendReminderMail; use App\Jobs\UpdateSlidesStatus; @@ -16,8 +14,11 @@ use Illuminate\Support\Facades\Date; return function (Schedule $schedule): void { $schedule->job(DeleteOldResetTokens::class)->everyMinute(); $schedule->job(UpdateSlidesStatus::class)->everyMinute(); - $schedule->job(FetchAndUpsertArcadiaEmployees::class)->onOneServer()->dailyAt('00:00'); - $schedule->job(FetchAndUpsertArcadiaProductIncos::class)->onOneServer()->dailyAt('02:00'); + + // FIXME: The Arcadia jobs are currently disabled and need to be enabled when api will be available. + // $schedule->job(FetchAndUpsertArcadiaEmployees::class)->onOneServer()->dailyAt('00:00'); + // $schedule->job(FetchAndUpsertArcadiaProductIncos::class)->onOneServer()->dailyAt('02:00'); + $schedule->job(SendReminderMail::class)->onOneServer()->dailyAt('10:00'); $schedule->job(SendMissingOrderReminderJob::class) ->onOneServer() diff --git a/tests/Feature/App/Http/Controllers/Bo/EmployeesControllerTest.php b/tests/Feature/App/Http/Controllers/Bo/EmployeesControllerTest.php index 5391cbe6..e918f8f2 100644 --- a/tests/Feature/App/Http/Controllers/Bo/EmployeesControllerTest.php +++ b/tests/Feature/App/Http/Controllers/Bo/EmployeesControllerTest.php @@ -11,23 +11,24 @@ describe('EmployeesController', function () { beforeEach(function () { // GIVEN /** @var \Tests\TestCase $this */ - $this->user = User::factory()->create(['role' => UserRole::SuperAdmin]); - $this->actingAs($this->user, 'backend'); + $user = User::factory()->create(['role' => UserRole::SuperAdmin]); + $this->actingAs($user, 'backend'); }); - it('can launch employee sync job', function () { - // GIVEN - /** @var \Tests\TestCase $this */ - Queue::fake(); + // FIXME: The Arcadia refresh action is inhibited, uncomment this test when api acrcadia is up. + // it('can launch employee sync job', function () { + // // GIVEN + // /** @var \Tests\TestCase $this */ + // Queue::fake(); - // WHEN - $response = $this->post('/bo/settings/employees/sync'); + // // WHEN + // $response = $this->post('/bo/settings/employees/sync'); - // THEN - $response->assertSessionHasNoErrors(); - $response->assertRedirect(route('bo.dashboard')); - Queue::assertPushed(FetchAndUpsertArcadiaEmployees::class); - }); + // // THEN + // $response->assertSessionHasNoErrors(); + // $response->assertRedirect(route('bo.dashboard')); + // Queue::assertPushed(FetchAndUpsertArcadiaEmployees::class); + // }); it('redirects unauthenticated users to login', function () { // GIVEN diff --git a/tests/Feature/Bo/Employees/EmployeeSyncFeatureTest.php b/tests/Feature/Bo/Employees/EmployeeSyncFeatureTest.php index b6681b2c..afb38eef 100644 --- a/tests/Feature/Bo/Employees/EmployeeSyncFeatureTest.php +++ b/tests/Feature/Bo/Employees/EmployeeSyncFeatureTest.php @@ -24,6 +24,12 @@ afterEach(function (): void { describe('Employee Sync Feature E2E', function (): void { it('configures sites in back office and synchronizes employees from Arcadia API into database', function (): void { + + // FIXME: Arcadia API is offline renablethis this test when up. + expect(true)->toBeTruthy(); + + return; + /** @var \Tests\TestCase $this */ // GIVEN