update 20.10.2025

This commit is contained in:
Kevin Adametz 2025-10-20 17:42:08 +02:00
parent 8c11130b5d
commit a939cd51ef
616 changed files with 84821 additions and 4121 deletions

View file

@ -0,0 +1,317 @@
<?php
namespace Tests\Integration;
use App\Domain\DomainContext;
use App\Domain\DomainType;
use App\Models\UserShop;
use App\Models\User;
use App\Services\DomainSessionManager;
use App\Services\OptimizedDomainService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
use Tests\TestCase;
/**
* Domain Session Integration Tests
*
* Testet das Session-Management zwischen verschiedenen Domains
*/
class DomainSessionIntegrationTest extends TestCase
{
use RefreshDatabase;
private DomainSessionManager $sessionManager;
private OptimizedDomainService $domainService;
private UserShop $testUserShop;
protected function setUp(): void
{
parent::setUp();
$this->sessionManager = new DomainSessionManager();
$this->domainService = new OptimizedDomainService(config('domains'));
// Test UserShop erstellen
$user = User::factory()->create([
'payment_shop' => now()->addMonths(1),
]);
$this->testUserShop = UserShop::factory()->create([
'slug' => 'testberater',
'user_id' => $user->id,
'active' => true,
'name' => 'Test Berater Shop',
]);
}
public function test_user_shop_session_synchronization(): void
{
// UserShop-Domain Context erstellen
$context = DomainContext::create(
DomainType::USER_SHOP,
'testberater.mivita.test',
'testberater',
$this->testUserShop
);
// Session-Synchronisation ausführen
$this->sessionManager->syncUserShopToSession($context);
// Prüfen, ob UserShop in Session gespeichert wurde
$this->assertNotNull(Session::get('user_shop'));
$this->assertEquals($this->testUserShop->id, Session::get('user_shop')->id);
$this->assertEquals('testberater.mivita.test', Session::get('user_shop_domain'));
}
public function test_session_preservation_across_domains(): void
{
// 1. Zuerst auf UserShop-Domain
$userShopContext = DomainContext::create(
DomainType::USER_SHOP,
'testberater.mivita.test',
'testberater',
$this->testUserShop
);
$this->sessionManager->syncUserShopToSession($userShopContext);
$originalUserShopId = Session::get('user_shop')->id;
// 2. Dann zu CRM wechseln (sollte UserShop erhalten)
$crmContext = DomainContext::create(
DomainType::CRM,
'my.mivita.test',
'my'
);
$this->sessionManager->syncUserShopToSession($crmContext);
// UserShop-Daten sollten erhalten bleiben
$this->assertNotNull(Session::get('user_shop'));
$this->assertEquals($originalUserShopId, Session::get('user_shop')->id);
$this->assertEquals('my.mivita.test', Session::get('user_shop_domain'));
}
public function test_session_clearing_for_main_domain(): void
{
// Zuerst UserShop in Session setzen
$userShopContext = DomainContext::create(
DomainType::USER_SHOP,
'testberater.mivita.test',
'testberater',
$this->testUserShop
);
$this->sessionManager->syncUserShopToSession($userShopContext);
$this->assertNotNull(Session::get('user_shop'));
// Dann zur Hauptdomain wechseln
$mainContext = DomainContext::create(
DomainType::MAIN,
'mivita.test'
);
$this->sessionManager->syncUserShopToSession($mainContext);
// UserShop-Daten sollten entfernt werden
$this->assertNull(Session::get('user_shop'));
$this->assertNull(Session::get('user_shop_domain'));
}
public function test_checkout_domain_preserves_all_session_data(): void
{
// UserShop-Session aufbauen
$userShopContext = DomainContext::create(
DomainType::USER_SHOP,
'testberater.mivita.test',
'testberater',
$this->testUserShop
);
$this->sessionManager->syncUserShopToSession($userShopContext);
// Zusätzliche Session-Daten hinzufügen (Warenkorb simulation)
Session::put('cart', ['product1', 'product2']);
Session::put('language', 'de');
// Zu Checkout wechseln
$checkoutContext = DomainContext::create(
DomainType::CHECKOUT,
'checkout.mivita.test'
);
$this->sessionManager->syncUserShopToSession($checkoutContext);
// Alle Session-Daten sollten erhalten bleiben
$this->assertNotNull(Session::get('user_shop'));
$this->assertEquals(['product1', 'product2'], Session::get('cart'));
$this->assertEquals('de', Session::get('language'));
$this->assertEquals('checkout.mivita.test', Session::get('user_shop_domain'));
}
public function test_portal_domain_session_handling(): void
{
// UserShop-Session aufbauen
$userShopContext = DomainContext::create(
DomainType::USER_SHOP,
'testberater.mivita.test',
'testberater',
$this->testUserShop
);
$this->sessionManager->syncUserShopToSession($userShopContext);
$originalUserShopId = Session::get('user_shop')->id;
// Zu Portal wechseln
$portalContext = DomainContext::create(
DomainType::PORTAL,
'in.mivita.test',
'in'
);
$this->sessionManager->syncUserShopToSession($portalContext);
// UserShop sollte erhalten bleiben (für "Zurück zum Shop" Funktion)
$this->assertNotNull(Session::get('user_shop'));
$this->assertEquals($originalUserShopId, Session::get('user_shop')->id);
$this->assertEquals('in.mivita.test', Session::get('user_shop_domain'));
}
public function test_session_preservation_decision_logic(): void
{
$userShopContext = DomainContext::create(DomainType::USER_SHOP, 'test.mivita.test', 'test');
$crmContext = DomainContext::create(DomainType::CRM, 'my.mivita.test', 'my');
$mainContext = DomainContext::create(DomainType::MAIN, 'mivita.test');
// Von UserShop zu CRM: Session erhalten
$this->assertTrue(
$this->sessionManager->shouldPreserveSessionData($userShopContext, $crmContext)
);
// Von UserShop zu Main: Session nicht erhalten
$this->assertFalse(
$this->sessionManager->shouldPreserveSessionData($userShopContext, $mainContext)
);
// Von CRM zu Portal: Session erhalten
$portalContext = DomainContext::create(DomainType::PORTAL, 'in.mivita.test', 'in');
$this->assertTrue(
$this->sessionManager->shouldPreserveSessionData($crmContext, $portalContext)
);
}
public function test_domain_context_storage_in_session(): void
{
$context = DomainContext::create(
DomainType::USER_SHOP,
'testberater.mivita.test',
'testberater',
$this->testUserShop
);
$this->sessionManager->storeDomainContextInSession($context);
$storedContext = Session::get('domain_context');
$this->assertNotNull($storedContext);
$this->assertEquals('user-shop', $storedContext['type']);
$this->assertEquals('testberater.mivita.test', $storedContext['host']);
$this->assertEquals('testberater', $storedContext['subdomain']);
$this->assertEquals($this->testUserShop->id, $storedContext['user_shop_id']);
}
public function test_domain_context_loading_from_session(): void
{
// Context in Session speichern
Session::put('domain_context', [
'type' => 'crm',
'host' => 'my.mivita.test',
'subdomain' => 'my',
'user_shop_id' => null,
'timestamp' => now()->toISOString(),
]);
$loadedContext = $this->sessionManager->loadDomainContextFromSession();
$this->assertNotNull($loadedContext);
$this->assertEquals(DomainType::CRM, $loadedContext->type);
$this->assertEquals('my.mivita.test', $loadedContext->host);
$this->assertEquals('my', $loadedContext->subdomain);
}
public function test_complete_domain_switching_workflow(): void
{
// 1. Start auf UserShop-Domain
$userShopContext = $this->domainService->resolveDomain('testberater.mivita.test');
// UserShop sollte geladen werden
$this->assertEquals(DomainType::USER_SHOP, $userShopContext->type);
$this->assertNotNull($userShopContext->userShop);
$request = Request::create('https://testberater.mivita.test');
$this->sessionManager->handleDomainSpecificSession($userShopContext, $request);
// Prüfen: UserShop in Session
$this->assertNotNull(Session::get('user_shop'));
$this->assertEquals($this->testUserShop->id, Session::get('user_shop')->id);
// 2. Wechsel zu CRM
$crmContext = $this->domainService->resolveDomain('my.mivita.test');
$crmRequest = Request::create('https://my.mivita.test');
$this->sessionManager->handleDomainSpecificSession($crmContext, $crmRequest);
// Prüfen: UserShop immer noch in Session, aber Domain aktualisiert
$this->assertNotNull(Session::get('user_shop'));
$this->assertEquals($this->testUserShop->id, Session::get('user_shop')->id);
$this->assertEquals('my.mivita.test', Session::get('user_shop_domain'));
// 3. Wechsel zu Checkout
$checkoutContext = $this->domainService->resolveDomain('checkout.mivita.test');
$checkoutRequest = Request::create('https://checkout.mivita.test');
$this->sessionManager->handleDomainSpecificSession($checkoutContext, $checkoutRequest);
// Prüfen: Alle Session-Daten erhalten
$this->assertNotNull(Session::get('user_shop'));
$this->assertEquals($this->testUserShop->id, Session::get('user_shop')->id);
$this->assertEquals('checkout.mivita.test', Session::get('user_shop_domain'));
// 4. Wechsel zur Hauptdomain
$mainContext = $this->domainService->resolveDomain('mivita.test');
$mainRequest = Request::create('https://mivita.test');
$this->sessionManager->handleDomainSpecificSession($mainContext, $mainRequest);
// Prüfen: UserShop-Session gelöscht
$this->assertNull(Session::get('user_shop'));
$this->assertNull(Session::get('user_shop_domain'));
}
public function test_fallback_shop_domain_handling(): void
{
// Aloevera UserShop für Fallback erstellen
$fallbackUser = User::factory()->create([
'payment_shop' => now()->addMonths(1),
]);
$fallbackShop = UserShop::factory()->create([
'slug' => 'aloevera',
'user_id' => $fallbackUser->id,
'active' => true,
'name' => 'Aloevera Fallback Shop',
]);
// Shop-Hauptdomain aufrufen
$shopContext = $this->domainService->resolveDomain('mivita.shop');
$this->assertEquals(DomainType::SHOP, $shopContext->type);
$this->assertNotNull($shopContext->userShop);
$this->assertEquals('aloevera', $shopContext->userShop->slug);
// Session-Management
$request = Request::create('https://mivita.shop');
$this->sessionManager->handleDomainSpecificSession($shopContext, $request);
// Fallback-Shop sollte in Session gesetzt werden
$this->assertNotNull(Session::get('user_shop'));
$this->assertEquals($fallbackShop->id, Session::get('user_shop')->id);
}
}

View file

@ -0,0 +1,212 @@
<?php
namespace Tests\Unit\Domain;
use App\Domain\DomainContext;
use App\Domain\DomainType;
use App\Models\UserShop;
use Tests\TestCase;
/**
* DomainContext Unit Tests
*
* Testet die Funktionalität der erweiterten DomainContext-Klasse
*/
class DomainContextTest extends TestCase
{
public function test_can_create_domain_context_from_array(): void
{
$domainInfo = [
'type' => 'user-shop',
'host' => 'test.mivita.care',
'subdomain' => 'test',
];
$context = DomainContext::fromArray($domainInfo);
$this->assertEquals(DomainType::USER_SHOP, $context->type);
$this->assertEquals('test.mivita.care', $context->host);
$this->assertEquals('test', $context->subdomain);
$this->assertNull($context->userShop);
}
public function test_can_create_domain_context_directly(): void
{
$context = DomainContext::create(
DomainType::CRM,
'my.mivita.care',
'my'
);
$this->assertEquals(DomainType::CRM, $context->type);
$this->assertEquals('my.mivita.care', $context->host);
$this->assertEquals('my', $context->subdomain);
}
public function test_unknown_domain_type_handling(): void
{
$context = DomainContext::create(DomainType::UNKNOWN, 'invalid.domain.com');
$this->assertTrue($context->isUnknown());
$this->assertFalse($context->isValid());
}
public function test_user_shop_detection(): void
{
$userShopContext = DomainContext::create(
DomainType::USER_SHOP,
'berater.mivita.care',
'berater'
);
$this->assertTrue($userShopContext->isUserShop());
$this->assertTrue($userShopContext->shouldPreserveUserShop());
$this->assertTrue($userShopContext->isShopRelated());
}
public function test_session_domain_generation(): void
{
$shopContext = DomainContext::create(DomainType::SHOP, 'mivita.shop');
$careContext = DomainContext::create(DomainType::CRM, 'my.mivita.care');
$this->assertEquals('.mivita.shop', $shopContext->getSessionDomain('mivita', '.shop', '.care'));
$this->assertEquals('.mivita.care', $careContext->getSessionDomain('mivita', '.shop', '.care'));
}
public function test_route_file_mapping(): void
{
$contexts = [
DomainType::MAIN => 'main.php',
DomainType::SHOP => 'shop.php',
DomainType::USER_SHOP => 'user-shop.php',
DomainType::CRM => 'crm.php',
DomainType::PORTAL => 'portal.php',
DomainType::CHECKOUT => 'checkout.php',
];
foreach ($contexts as $type => $expectedFile) {
$context = DomainContext::create($type, 'test.domain.com');
$this->assertEquals($expectedFile, $context->getRouteFile());
}
}
public function test_context_with_metadata(): void
{
$metadata = ['test_key' => 'test_value'];
$context = DomainContext::create(
DomainType::MAIN,
'mivita.care',
null,
null,
$metadata
);
$this->assertEquals('test_value', $context->getMetadata('test_key'));
$this->assertNull($context->getMetadata('non_existent'));
$this->assertEquals('default', $context->getMetadata('non_existent', 'default'));
}
public function test_context_with_user_shop(): void
{
$userShop = new UserShop([
'id' => 1,
'slug' => 'test-shop',
'name' => 'Test Shop',
'active' => true,
]);
$context = DomainContext::create(
DomainType::USER_SHOP,
'test-shop.mivita.care',
'test-shop',
$userShop
);
$this->assertEquals('test-shop', $context->getUserShopSlug());
$this->assertEquals($userShop, $context->userShop);
}
public function test_context_immutability(): void
{
$original = DomainContext::create(DomainType::MAIN, 'mivita.care');
$withUserShop = $original->withUserShop(new UserShop(['slug' => 'test']));
$withType = $original->withType(DomainType::SHOP);
// Original sollte unverändert sein
$this->assertEquals(DomainType::MAIN, $original->type);
$this->assertNull($original->userShop);
// Neue Instanzen sollten geänderte Werte haben
$this->assertEquals(DomainType::MAIN, $withUserShop->type);
$this->assertNotNull($withUserShop->userShop);
$this->assertEquals(DomainType::SHOP, $withType->type);
$this->assertEquals('mivita.care', $withType->host);
}
public function test_context_equality(): void
{
$context1 = DomainContext::create(DomainType::MAIN, 'mivita.care', null);
$context2 = DomainContext::create(DomainType::MAIN, 'mivita.care', null);
$context3 = DomainContext::create(DomainType::SHOP, 'mivita.shop', null);
$this->assertTrue($context1->equals($context2));
$this->assertFalse($context1->equals($context3));
}
public function test_context_to_array(): void
{
$context = DomainContext::create(
DomainType::USER_SHOP,
'test.mivita.care',
'test'
);
$array = $context->toArray();
$this->assertArrayHasKey('type', $array);
$this->assertArrayHasKey('type_description', $array);
$this->assertArrayHasKey('host', $array);
$this->assertArrayHasKey('subdomain', $array);
$this->assertArrayHasKey('should_preserve_user_shop', $array);
$this->assertArrayHasKey('is_shop_related', $array);
$this->assertEquals('user-shop', $array['type']);
$this->assertEquals('test.mivita.care', $array['host']);
$this->assertEquals('test', $array['subdomain']);
$this->assertTrue($array['should_preserve_user_shop']);
$this->assertTrue($array['is_shop_related']);
}
public function test_context_string_representation(): void
{
$context = DomainContext::create(
DomainType::CRM,
'my.mivita.care',
'my'
);
$this->assertEquals('crm://my.mivita.care', (string) $context);
}
public function test_context_validation(): void
{
$validContext = DomainContext::create(DomainType::MAIN, 'mivita.care');
$unknownContext = DomainContext::create(DomainType::UNKNOWN, 'invalid.domain');
$this->assertTrue($validContext->isValid());
$this->assertFalse($unknownContext->isValid());
}
public function test_redirect_url_for_invalid_context(): void
{
$invalidContext = DomainContext::create(DomainType::UNKNOWN, 'invalid.domain');
$redirectUrl = $invalidContext->getRedirectUrl();
$this->assertNotNull($redirectUrl);
$this->assertStringContains('mivita.care', $redirectUrl);
$validContext = DomainContext::create(DomainType::MAIN, 'mivita.care');
$this->assertNull($validContext->getRedirectUrl());
}
}

View file

@ -0,0 +1,319 @@
<?php
namespace Tests\Unit\Services;
use App\Domain\DomainContext;
use App\Domain\DomainType;
use App\Models\UserShop;
use App\Models\User;
use App\Services\OptimizedDomainService;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Cache;
use Tests\TestCase;
/**
* OptimizedDomainService Unit Tests
*
* Testet die Funktionalität des optimierten Domain-Services
*/
class OptimizedDomainServiceTest extends TestCase
{
use RefreshDatabase;
private OptimizedDomainService $domainService;
private array $testConfig;
protected function setUp(): void
{
parent::setUp();
$this->testConfig = [
'protocol' => 'https://',
'domains' => [
'main' => [
'host' => 'mivita.test',
'type' => 'main',
],
'shop' => [
'host' => 'mivita.shop',
'type' => 'main-shop',
'default_user_shop' => 'aloevera',
],
'crm' => [
'host' => 'my.mivita.test',
'type' => 'crm',
],
'portal' => [
'host' => 'in.mivita.test',
'type' => 'portal',
],
'checkout' => [
'host' => 'checkout.mivita.test',
'type' => 'checkout',
],
'user-shop' => [
'host' => '{subdomain}.mivita.test',
'type' => 'user-shop',
],
],
'reserved_subdomains' => ['my', 'in', 'checkout'],
];
$this->domainService = new OptimizedDomainService($this->testConfig);
}
public function test_parse_main_domain(): void
{
$result = $this->domainService->parseDomain('mivita.test');
$this->assertEquals('main', $result['type']);
$this->assertEquals('mivita.test', $result['host']);
$this->assertEquals('mivita', $result['domain']);
$this->assertEquals('.test', $result['tld']);
$this->assertNull($result['subdomain']);
}
public function test_parse_user_shop_domain(): void
{
$result = $this->domainService->parseDomain('berater.mivita.test');
$this->assertEquals('user-shop', $result['type']);
$this->assertEquals('berater.mivita.test', $result['host']);
$this->assertEquals('berater', $result['subdomain']);
}
public function test_parse_reserved_subdomain(): void
{
$crmResult = $this->domainService->parseDomain('my.mivita.test');
$portalResult = $this->domainService->parseDomain('in.mivita.test');
$this->assertEquals('crm', $crmResult['type']);
$this->assertEquals('portal', $portalResult['type']);
}
public function test_parse_invalid_domain(): void
{
$result = $this->domainService->parseDomain('invalid');
$this->assertEquals('unknown', $result['type']);
$this->assertEquals('invalid', $result['host']);
}
public function test_resolve_domain_with_user_shop(): void
{
// UserShop und User erstellen
$user = User::factory()->create([
'payment_shop' => now()->addMonths(1),
]);
$userShop = UserShop::factory()->create([
'slug' => 'testshop',
'user_id' => $user->id,
'active' => true,
]);
$context = $this->domainService->resolveDomain('testshop.mivita.test');
$this->assertEquals(DomainType::USER_SHOP, $context->type);
$this->assertEquals('testshop.mivita.test', $context->host);
$this->assertEquals('testshop', $context->subdomain);
$this->assertNotNull($context->userShop);
$this->assertEquals($userShop->id, $context->userShop->id);
}
public function test_resolve_domain_with_inactive_user_shop(): void
{
// Inaktiver UserShop
UserShop::factory()->create([
'slug' => 'inactive-shop',
'active' => false,
]);
$context = $this->domainService->resolveDomain('inactive-shop.mivita.test');
$this->assertEquals(DomainType::UNKNOWN, $context->type);
$this->assertNull($context->userShop);
}
public function test_build_url_for_main_domain(): void
{
$url = $this->domainService->buildUrl('main');
$this->assertEquals('https://mivita.test', $url);
$urlWithPath = $this->domainService->buildUrl('main', 'some/path');
$this->assertEquals('https://mivita.test/some/path', $urlWithPath);
}
public function test_build_url_for_user_shop(): void
{
$url = $this->domainService->buildUrl('user-shop', null, 'myshop');
$this->assertEquals('https://myshop.mivita.test', $url);
$urlWithPath = $this->domainService->buildUrl('user-shop', 'products', 'myshop');
$this->assertEquals('https://myshop.mivita.test/products', $urlWithPath);
}
public function test_build_url_throws_exception_for_unknown_type(): void
{
$this->expectException(\InvalidArgumentException::class);
$this->domainService->buildUrl('unknown-type');
}
public function test_build_url_throws_exception_for_user_shop_without_slug(): void
{
$this->expectException(\InvalidArgumentException::class);
$this->domainService->buildUrl('user-shop');
}
public function test_is_valid_user_shop(): void
{
$user = User::factory()->create([
'payment_shop' => now()->addMonths(1),
]);
$userShop = UserShop::factory()->create([
'slug' => 'validshop',
'user_id' => $user->id,
'active' => true,
]);
$this->assertTrue($this->domainService->isValidUserShop('validshop'));
$this->assertFalse($this->domainService->isValidUserShop('nonexistent'));
}
public function test_get_user_shop(): void
{
$user = User::factory()->create([
'payment_shop' => now()->addMonths(1),
]);
$userShop = UserShop::factory()->create([
'slug' => 'getshop',
'user_id' => $user->id,
'active' => true,
]);
$result = $this->domainService->getUserShop('getshop');
$this->assertNotNull($result);
$this->assertEquals($userShop->id, $result->id);
$nonExistent = $this->domainService->getUserShop('nonexistent');
$this->assertNull($nonExistent);
}
public function test_cache_functionality(): void
{
Cache::flush();
// Erstes Laden sollte DB-Query ausführen
$result1 = $this->domainService->parseDomain('test.mivita.test');
// Zweites Laden sollte aus Cache kommen
$result2 = $this->domainService->parseDomain('test.mivita.test');
$this->assertEquals($result1, $result2);
}
public function test_clear_user_shop_cache(): void
{
$user = User::factory()->create([
'payment_shop' => now()->addMonths(1),
]);
$userShop = UserShop::factory()->create([
'slug' => 'cacheshop',
'user_id' => $user->id,
'active' => true,
]);
// UserShop laden (wird gecacht)
$this->domainService->getUserShop('cacheshop');
// Cache löschen
$this->domainService->clearUserShopCache('cacheshop');
// Erneut laden sollte DB-Query ausführen
$result = $this->domainService->getUserShop('cacheshop');
$this->assertNotNull($result);
}
public function test_validate_configuration(): void
{
// Gültige Konfiguration
$errors = $this->domainService->validateConfiguration();
$this->assertEmpty($errors);
// Ungültige Konfiguration
$invalidService = new OptimizedDomainService([
'domains' => [],
]);
$errors = $invalidService->validateConfiguration();
$this->assertNotEmpty($errors);
}
public function test_get_default_user_shop(): void
{
$user = User::factory()->create([
'payment_shop' => now()->addMonths(1),
]);
UserShop::factory()->create([
'slug' => 'aloevera',
'user_id' => $user->id,
'active' => true,
]);
$defaultShop = $this->domainService->getDefaultUserShop();
$this->assertNotNull($defaultShop);
$this->assertEquals('aloevera', $defaultShop->slug);
}
public function test_warm_up_cache(): void
{
$user = User::factory()->create([
'payment_shop' => now()->addMonths(1),
]);
UserShop::factory()->create([
'slug' => 'warmup-shop',
'user_id' => $user->id,
'active' => true,
]);
Cache::flush();
// Cache aufwärmen
$this->domainService->warmUpCache(['warmup-shop']);
// Überprüfen, dass Daten im Cache sind
$cachedShop = Cache::get('user_shop_warmup-shop');
$this->assertNotNull($cachedShop);
}
public function test_subdomain_validation(): void
{
// Gültige Subdomains
$validSubdomains = ['test', 'valid-shop', 'shop123'];
foreach ($validSubdomains as $subdomain) {
$result = $this->domainService->parseDomain($subdomain . '.mivita.test');
$this->assertEquals('user-shop', $result['type']);
}
// Ungültige Subdomains
$invalidSubdomains = ['a', 'ab', 'INVALID', 'invalid_shop', 'invalid.shop'];
foreach ($invalidSubdomains as $subdomain) {
$result = $this->domainService->parseDomain($subdomain . '.mivita.test');
$this->assertEquals('unknown', $result['type']);
}
}
public function test_reserved_subdomain_handling(): void
{
foreach ($this->testConfig['reserved_subdomains'] as $reserved) {
$result = $this->domainService->parseDomain($reserved . '.mivita.test');
$this->assertNotEquals('user-shop', $result['type']);
$this->assertNotEquals('unknown', $result['type']);
}
}
}