mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-11 12:09:36 +00:00
Merge branch 'master' into feature/update-manager
This commit is contained in:
commit
599145886b
10 changed files with 286 additions and 26 deletions
|
|
@ -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')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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'];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue