tenantResolver = new TenantResolver(); } public function testResolveTenantFromSubdomain(): void { $requestFactory = new ServerRequestFactory(); $request = $requestFactory->createServerRequest('GET', 'https://abc.merchantsofhope.org'); $tenant = $this->tenantResolver->resolveTenant($request); $this->assertNotNull($tenant); $this->assertEquals('abc', $tenant->getSubdomain()); $this->assertEquals('Abc Tenant', $tenant->getName()); } public function testResolveTenantFromPath(): void { $requestFactory = new ServerRequestFactory(); $request = $requestFactory->createServerRequest('GET', 'https://merchantsofhope.org/xyz'); $tenant = $this->tenantResolver->resolveTenant($request); $this->assertNotNull($tenant); $this->assertEquals('xyz', $tenant->getSubdomain()); $this->assertEquals('Xyz Tenant', $tenant->getName()); } public function testResolveTenantWithNoTenant(): void { $requestFactory = new ServerRequestFactory(); $request = $requestFactory->createServerRequest('GET', 'https://merchantsofhope.org'); $tenant = $this->tenantResolver->resolveTenant($request); $this->assertNull($tenant); } public function testResolveTenantFromInvalidSubdomain(): void { $requestFactory = new ServerRequestFactory(); $request = $requestFactory->createServerRequest('GET', 'https://merchantsofhope.org'); $tenant = $this->tenantResolver->resolveTenant($request); $this->assertNull($tenant); } }