Fixed tests

This commit is contained in:
Jan Böhmer 2026-02-22 23:50:32 +01:00 committed by Marc Kreidler
parent 0fbbcd26fb
commit a9e770f250
2 changed files with 5 additions and 7 deletions

View file

@ -87,7 +87,7 @@ class CanopySettings
*/ */
public function getRealDomain(): string public function getRealDomain(): string
{ {
$domain = array_search($this->domain, self::ALLOWED_DOMAINS); $domain = array_search($this->domain, self::ALLOWED_DOMAINS, true);
if ($domain === false) { if ($domain === false) {
throw new \InvalidArgumentException("Invalid domain selected"); throw new \InvalidArgumentException("Invalid domain selected");
} }

View file

@ -92,7 +92,7 @@ final class BarcodeScanResultHandlerTest extends KernelTestCase
$this->assertNull($url); $this->assertNull($url);
} }
public function testGetRedirectURLThrowsOnUnknownScanType(): void public function testGetRedirectURLReturnsNullOnUnknownScanType(): void
{ {
$unknown = new class implements BarcodeScanResultInterface { $unknown = new class implements BarcodeScanResultInterface {
public function getDecodedForInfoMode(): array public function getDecodedForInfoMode(): array
@ -101,8 +101,7 @@ final class BarcodeScanResultHandlerTest extends KernelTestCase
} }
}; };
$this->expectException(InvalidArgumentException::class); $this->assertNull($this->service->getInfoURL($unknown));
$this->service->getInfoURL($unknown);
} }
public function testEIGPBarcodeResolvePartOrNullReturnsNullWhenNotFound(): void public function testEIGPBarcodeResolvePartOrNullReturnsNullWhenNotFound(): void
@ -124,7 +123,7 @@ final class BarcodeScanResultHandlerTest extends KernelTestCase
$this->assertNull($this->service->getInfoURL($scan)); $this->assertNull($this->service->getInfoURL($scan));
} }
public function testResolveEntityThrowsOnUnknownScanType(): void public function testResolveEntityReturnNullOnUnknownScanType(): void
{ {
$unknown = new class implements BarcodeScanResultInterface { $unknown = new class implements BarcodeScanResultInterface {
public function getDecodedForInfoMode(): array public function getDecodedForInfoMode(): array
@ -133,8 +132,7 @@ final class BarcodeScanResultHandlerTest extends KernelTestCase
} }
}; };
$this->expectException(InvalidArgumentException::class); $this->assertNull($this->service->resolvePart($unknown));
$this->service->resolvePart($unknown);
} }
public function testResolveEntity(): void public function testResolveEntity(): void