Merge branch 'master' into feature/update-manager

This commit is contained in:
Jan Böhmer 2026-02-02 16:43:02 +01:00
commit 599145886b
10 changed files with 286 additions and 26 deletions

View file

@ -24,6 +24,7 @@ namespace App\Tests\Services\InfoProviderSystem;
use App\Services\InfoProviderSystem\ProviderRegistry;
use App\Services\InfoProviderSystem\Providers\InfoProviderInterface;
use App\Services\InfoProviderSystem\Providers\URLHandlerInfoProviderInterface;
use PHPUnit\Framework\TestCase;
class ProviderRegistryTest extends TestCase
@ -44,9 +45,10 @@ class ProviderRegistryTest extends TestCase
public function getMockProvider(string $key, bool $active = true): InfoProviderInterface
{
$mock = $this->createMock(InfoProviderInterface::class);
$mock = $this->createMockForIntersectionOfInterfaces([InfoProviderInterface::class, URLHandlerInfoProviderInterface::class]);
$mock->method('getProviderKey')->willReturn($key);
$mock->method('isActive')->willReturn($active);
$mock->method('getHandledDomains')->willReturn(["$key.com", "test.$key.de"]);
return $mock;
}
@ -109,4 +111,18 @@ class ProviderRegistryTest extends TestCase
$registry->getProviders();
}
public function testGetProviderHandlingDomain(): void
{
$registry = new ProviderRegistry($this->providers);
$this->assertEquals($this->providers[0], $registry->getProviderHandlingDomain('test1.com'));
$this->assertEquals($this->providers[0], $registry->getProviderHandlingDomain('www.test1.com')); //Subdomain should also work
$this->assertEquals(
$this->providers[1],
$registry->getProviderHandlingDomain('test.test2.de')
);
}
}

View file

@ -64,7 +64,7 @@ final class BarcodeRedirectorTest extends KernelTestCase
{
yield [new LocalBarcodeScanResult(LabelSupportedElement::PART, 1, BarcodeSourceType::INTERNAL), '/en/part/1'];
//Part lot redirects to Part info page (Part lot 1 is associated with part 3)
yield [new LocalBarcodeScanResult(LabelSupportedElement::PART_LOT, 1, BarcodeSourceType::INTERNAL), '/en/part/3'];
yield [new LocalBarcodeScanResult(LabelSupportedElement::PART_LOT, 1, BarcodeSourceType::INTERNAL), '/en/part/3?highlightLot=1'];
yield [new LocalBarcodeScanResult(LabelSupportedElement::STORELOCATION, 1, BarcodeSourceType::INTERNAL), '/en/store_location/1/parts'];
}