From a67f106bc60cbf911ceb28ab95ae729a7115cbc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 22 Feb 2026 23:50:32 +0100 Subject: [PATCH] Fixed tests --- src/Settings/InfoProviderSystem/CanopySettings.php | 2 +- .../BarcodeScanner/BarcodeScanResultHandlerTest.php | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Settings/InfoProviderSystem/CanopySettings.php b/src/Settings/InfoProviderSystem/CanopySettings.php index 88e1fcb7..0858871b 100644 --- a/src/Settings/InfoProviderSystem/CanopySettings.php +++ b/src/Settings/InfoProviderSystem/CanopySettings.php @@ -87,7 +87,7 @@ class CanopySettings */ public function getRealDomain(): string { - $domain = array_search($this->domain, self::ALLOWED_DOMAINS); + $domain = array_search($this->domain, self::ALLOWED_DOMAINS, true); if ($domain === false) { throw new \InvalidArgumentException("Invalid domain selected"); } diff --git a/tests/Services/LabelSystem/BarcodeScanner/BarcodeScanResultHandlerTest.php b/tests/Services/LabelSystem/BarcodeScanner/BarcodeScanResultHandlerTest.php index 840e84c0..95313e13 100644 --- a/tests/Services/LabelSystem/BarcodeScanner/BarcodeScanResultHandlerTest.php +++ b/tests/Services/LabelSystem/BarcodeScanner/BarcodeScanResultHandlerTest.php @@ -92,7 +92,7 @@ final class BarcodeScanResultHandlerTest extends KernelTestCase $this->assertNull($url); } - public function testGetRedirectURLThrowsOnUnknownScanType(): void + public function testGetRedirectURLReturnsNullOnUnknownScanType(): void { $unknown = new class implements BarcodeScanResultInterface { public function getDecodedForInfoMode(): array @@ -101,8 +101,7 @@ final class BarcodeScanResultHandlerTest extends KernelTestCase } }; - $this->expectException(InvalidArgumentException::class); - $this->service->getInfoURL($unknown); + $this->assertNull($this->service->getInfoURL($unknown)); } public function testEIGPBarcodeResolvePartOrNullReturnsNullWhenNotFound(): void @@ -124,7 +123,7 @@ final class BarcodeScanResultHandlerTest extends KernelTestCase $this->assertNull($this->service->getInfoURL($scan)); } - public function testResolveEntityThrowsOnUnknownScanType(): void + public function testResolveEntityReturnNullOnUnknownScanType(): void { $unknown = new class implements BarcodeScanResultInterface { public function getDecodedForInfoMode(): array @@ -133,8 +132,7 @@ final class BarcodeScanResultHandlerTest extends KernelTestCase } }; - $this->expectException(InvalidArgumentException::class); - $this->service->resolvePart($unknown); + $this->assertNull($this->service->resolvePart($unknown)); } public function testResolveEntity(): void