From c3fbdc7f06a3ad3942d93bcf559a96de078cd875 Mon Sep 17 00:00:00 2001 From: Artem Otliaguzov Date: Tue, 16 Jul 2024 10:16:51 +0200 Subject: [PATCH] fix test and run pint --- app/Jobs/EduGainAddEntity.php | 2 +- app/Jobs/EduGainDeleteEntity.php | 5 ++--- app/Listeners/SendDeletedEntityToDeleteJob.php | 4 +--- tests/Feature/Http/Controllers/EntityControllerTest.php | 3 --- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/Jobs/EduGainAddEntity.php b/app/Jobs/EduGainAddEntity.php index b43d768..0e7c94c 100644 --- a/app/Jobs/EduGainAddEntity.php +++ b/app/Jobs/EduGainAddEntity.php @@ -19,7 +19,7 @@ class EduGainAddEntity implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; - use HandlesJobsFailuresTrait,EdugainTrait; + use EdugainTrait,HandlesJobsFailuresTrait; public Entity $entity; diff --git a/app/Jobs/EduGainDeleteEntity.php b/app/Jobs/EduGainDeleteEntity.php index e31cdf1..d74847d 100644 --- a/app/Jobs/EduGainDeleteEntity.php +++ b/app/Jobs/EduGainDeleteEntity.php @@ -23,7 +23,7 @@ class EduGainDeleteEntity implements ShouldQueue /** * trait with failure function */ - use HandlesJobsFailuresTrait,EdugainTrait; + use EdugainTrait,HandlesJobsFailuresTrait; public Entity $entity; @@ -44,7 +44,7 @@ public function handle(): void $folderName = config('storageCfg.edu2edugain'); if (! Storage::disk($diskName)->exists($folderName)) { - $this->makeEdu2Edugain(); + $this->makeEdu2Edugain(); } try { @@ -61,7 +61,6 @@ public function handle(): void $lock->block(61); EntityFacade::deleteEntityMetadataFromFolder($this->entity->file, $folderName); - EduGainRunMdaScript::dispatch($lock->owner()); } catch (Exception $e) { Log::error($e->getMessage()); diff --git a/app/Listeners/SendDeletedEntityToDeleteJob.php b/app/Listeners/SendDeletedEntityToDeleteJob.php index 04420d1..36ff8e9 100644 --- a/app/Listeners/SendDeletedEntityToDeleteJob.php +++ b/app/Listeners/SendDeletedEntityToDeleteJob.php @@ -23,8 +23,7 @@ public function handle(DeleteEntity $event): void { $entity = $event->entity; - if(!$entity->isForceDeleting()) - { + if (! $entity->isForceDeleting()) { FolderDeleteEntity::dispatch($event->entity); if ($event->entity->edugain == 1) { @@ -32,6 +31,5 @@ public function handle(DeleteEntity $event): void } } - } } diff --git a/tests/Feature/Http/Controllers/EntityControllerTest.php b/tests/Feature/Http/Controllers/EntityControllerTest.php index 3b44fb8..d761b93 100644 --- a/tests/Feature/Http/Controllers/EntityControllerTest.php +++ b/tests/Feature/Http/Controllers/EntityControllerTest.php @@ -2,7 +2,6 @@ namespace Tests\Feature\Http\Controllers; -use App\Jobs\FolderDeleteEntity; use App\Models\Entity; use App\Models\Federation; use App\Models\Membership; @@ -1474,7 +1473,6 @@ public function an_admin_can_purge_an_existing_entity() ->delete(route('entities.destroy', $entity)) ->assertSeeText(__('entities.destroyed', ['name' => $name])); - Queue::assertPushed(FolderDeleteEntity::class); } /** @test */ @@ -1496,7 +1494,6 @@ public function an_admin_can_reject_a_new_entity_request() ->delete(route('memberships.destroy', $membership)) ->assertSeeText(__('federations.membership_rejected', ['entity' => $entity->name_en])); - Queue::assertPushed(FolderDeleteEntity::class); } /** @test */