From f11a7d4bb8ca9064b865cc2d26d4a1d09b38b7bf Mon Sep 17 00:00:00 2001
From: Henning <leutz@pcsg.de>
Date: Sun, 23 Feb 2025 08:52:20 +0100
Subject: [PATCH] refactor(phpunit): ensure consistent handling of processing
 status id

This commit improves the way processing status id is handled across different methods in the
ProcessingStatus module. Now, we consistently cast processing status id as string before passing it
to the config setter methods, eliminating any potential issues that might occur due to variable
type inconsistencies. Changes are applied to the Factory and Handler classes alike.

Related: quiqqer/order#172
---
 src/QUI/ERP/Order/ProcessingStatus/Factory.php | 4 ++--
 src/QUI/ERP/Order/ProcessingStatus/Handler.php | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/QUI/ERP/Order/ProcessingStatus/Factory.php b/src/QUI/ERP/Order/ProcessingStatus/Factory.php
index b9aa7d28..42ebf8ee 100644
--- a/src/QUI/ERP/Order/ProcessingStatus/Factory.php
+++ b/src/QUI/ERP/Order/ProcessingStatus/Factory.php
@@ -31,7 +31,7 @@ class Factory extends QUI\Utils\Singleton
      * @throws QUI\Exception
      * @todo permissions
      */
-    public function createProcessingStatus(int|string $id, string $color, array $title): void
+    public function createProcessingStatus(int | string $id, string $color, array $title): void
     {
         $list = Handler::getInstance()->getList();
         $id = (int)$id;
@@ -48,7 +48,7 @@ public function createProcessingStatus(int|string $id, string $color, array $tit
         $Package = QUI::getPackage('quiqqer/order');
         $Config = $Package->getConfig();
 
-        $Config->setValue('processing_status', $id, $color);
+        $Config->setValue('processing_status', (string)$id, $color);
         $Config->save();
 
         // translations
diff --git a/src/QUI/ERP/Order/ProcessingStatus/Handler.php b/src/QUI/ERP/Order/ProcessingStatus/Handler.php
index 37b209f1..403d6a00 100644
--- a/src/QUI/ERP/Order/ProcessingStatus/Handler.php
+++ b/src/QUI/ERP/Order/ProcessingStatus/Handler.php
@@ -149,7 +149,7 @@ public function deleteProcessingStatus(int | string $id): void
         QUI\Translator::publish('quiqqer/order');
 
         // update config
-        $this->OrderConfig->del('processing_status', $Status->getId());
+        $this->OrderConfig->del('processing_status', (string)$Status->getId());
         $this->OrderConfig->save();
     }
 
@@ -168,7 +168,7 @@ public function setProcessingStatusNotification(int $id, bool $notify): void
         $Status = $this->getProcessingStatus($id);
 
         // update config
-        $this->OrderConfig->setValue('processing_status_notification', $Status->getId(), $notify ? "1" : "0");
+        $this->OrderConfig->setValue('processing_status_notification', (string)$Status->getId(), $notify ? "1" : "0");
         $this->OrderConfig->save();
     }
 
@@ -213,7 +213,7 @@ public function updateProcessingStatus(int | string $id, int | string $color, ar
         QUI\Translator::publish('quiqqer/order');
 
         // update config
-        $this->OrderConfig->setValue('processing_status', $Status->getId(), $color);
+        $this->OrderConfig->setValue('processing_status', (string)$Status->getId(), $color);
         $this->OrderConfig->save();
     }
 
-- 
GitLab