35 lines
994 B
PHP
35 lines
994 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace MageSail\Magesail\Test\Unit\Model;
|
|
|
|
use MageSail\Magesail\Model\TunnelRegistry;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
/**
|
|
* Host parsing helpers used by TunnelHostnameMatcher (no Magento runtime required).
|
|
*/
|
|
class TunnelRegistryHostParsingTest extends TestCase
|
|
{
|
|
public function testHostFromHttpHostStripsPort(): void
|
|
{
|
|
self::assertSame('dev.local', TunnelRegistry::hostFromHttpHost('dev.local:8080'));
|
|
}
|
|
|
|
public function testHostFromHttpHostNullForEmpty(): void
|
|
{
|
|
self::assertNull(TunnelRegistry::hostFromHttpHost(null));
|
|
self::assertNull(TunnelRegistry::hostFromHttpHost(''));
|
|
}
|
|
|
|
public function testHostFromBaseUrlExtractsHost(): void
|
|
{
|
|
self::assertSame('shop.test', TunnelRegistry::hostFromBaseUrl('https://shop.test/base/'));
|
|
}
|
|
|
|
public function testHostFromBaseUrlInvalidReturnsNull(): void
|
|
{
|
|
self::assertNull(TunnelRegistry::hostFromBaseUrl('not-a-url'));
|
|
}
|
|
}
|