configPath = storage_path('framework/testing/traefik-customers.yaml'); config(['hosting.traefik.dynamic_config_path' => $this->configPath]); if (File::exists($this->configPath)) { File::delete($this->configPath); } } protected function tearDown(): void { if (File::exists($this->configPath)) { File::delete($this->configPath); } parent::tearDown(); } public function test_adds_customer_route_with_tls(): void { $generator = app(TraefikGenerator::class); $generator->addCustomerRoute('kunde1.hexahost.de', '10.12.10.11'); $yaml = File::get($this->configPath); $this->assertStringContainsString('kunde1.hexahost.de', $yaml); $this->assertStringContainsString('10.12.10.11', $yaml); $this->assertStringContainsString('letsencrypt', $yaml); $this->assertStringContainsString('websecure', $yaml); } public function test_preserves_existing_non_managed_routes(): void { File::ensureDirectoryExists(dirname($this->configPath)); File::put($this->configPath, <<<'YAML' http: routers: admin-panel: rule: "Host(`admin.example.com`)" service: admin-panel services: admin-panel: loadBalancer: servers: - url: "http://127.0.0.1:8080" YAML); $generator = app(TraefikGenerator::class); $generator->addCustomerRoute('kunde1.hexahost.de', '10.12.10.12'); $yaml = File::get($this->configPath); $this->assertStringContainsString('admin-panel', $yaml); $this->assertStringContainsString('kunde1.hexahost.de', $yaml); } public function test_rejects_invalid_domain(): void { $this->expectException(\App\Exceptions\Hosting\TraefikException::class); app(TraefikGenerator::class)->addCustomerRoute('not a domain!', '10.12.10.11'); } }