2026-08-05 19:24:25 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
it('shows internal Docker access details in application general settings', function () {
|
|
|
|
|
$generalSettings = file_get_contents(resource_path('views/livewire/project/application/general.blade.php'));
|
|
|
|
|
$generalComponent = file_get_contents(app_path('Livewire/Project/Application/General.php'));
|
2026-08-06 12:29:25 +00:00
|
|
|
$internalAccessSettings = file_get_contents(resource_path('views/livewire/project/application/internal-access.blade.php'));
|
|
|
|
|
$internalAccessComponent = file_get_contents(app_path('Livewire/Project/Application/InternalAccess.php'));
|
2026-08-05 19:24:25 +00:00
|
|
|
$configurationSidebar = file_get_contents(resource_path('views/components/application/configuration-sidebar.blade.php'));
|
|
|
|
|
|
|
|
|
|
expect($generalSettings)
|
2026-08-06 12:29:25 +00:00
|
|
|
->toContain('id="access-section" title="Access"')
|
2026-08-06 12:30:06 +00:00
|
|
|
->toContain('<h3 class="mb-3 text-sm font-semibold text-black dark:text-fg">Public access</h3>')
|
2026-09-10 06:36:15 +00:00
|
|
|
->toContain('$primaryDomain = null;')
|
|
|
|
|
->toContain('$additionalDomainCount = max(0, $domainCount - 1);')
|
|
|
|
|
->toContain("aria-label=\"{{ \$domainCount > 0 ? 'Manage application domains' : 'Add an application domain' }}\"")
|
|
|
|
|
->toContain('{{ $primaryDomain }}')
|
|
|
|
|
->toContain("+{{ \$additionalDomainCount }} more {{ Str::plural('domain', \$additionalDomainCount) }}")
|
|
|
|
|
->toContain('No public domain configured')
|
|
|
|
|
->toContain('Make this application available from a URL')
|
|
|
|
|
->toContain("{{ \$domainCount > 0 ? 'Manage domains' : 'Add domain' }}")
|
|
|
|
|
->toContain('class="button relative z-10 ml-auto shrink-0"')
|
|
|
|
|
->toContain('aria-label="{{ $domainCount > 0 ? \'Manage application domains\' : \'Add an application domain\' }}"')
|
|
|
|
|
->toContain('<x-reicon name="arrow-right" class="size-4" />')
|
|
|
|
|
->not->toContain('<x-reicon name="settings" class="size-4" />')
|
2026-08-06 12:29:25 +00:00
|
|
|
->toContain('<livewire:project.application.internal-access')
|
|
|
|
|
->not->toContain('wire:init="loadCurrentInternalHostname"')
|
|
|
|
|
->and($internalAccessSettings)
|
2026-08-05 19:24:25 +00:00
|
|
|
->toContain('id="internal-access-section"')
|
2026-08-06 12:29:25 +00:00
|
|
|
->toContain('<h3 class="mb-4 text-sm font-semibold text-black dark:text-fg">Internal access</h3>')
|
|
|
|
|
->not->toContain('<x-application.settings-section')
|
2026-08-05 19:24:25 +00:00
|
|
|
->toContain('Internal hostname')
|
|
|
|
|
->toContain('Docker network')
|
|
|
|
|
->toContain('Exposed ports')
|
|
|
|
|
->toContain('Network aliases')
|
|
|
|
|
->toContain('wire:init="loadCurrentInternalHostname"')
|
|
|
|
|
->toContain('$currentInternalHostname')
|
2026-08-06 11:58:33 +00:00
|
|
|
->toContain('class="input input-with-copy-button bg-white dark:bg-coolgray-100 dark:read-only:bg-coolgray-100 dark:read-only:text-white"')
|
2026-08-05 19:24:25 +00:00
|
|
|
->not->toContain('Changes with each deployment')
|
|
|
|
|
->toContain("window.scrollToSettingsSection?.('networking-section')")
|
|
|
|
|
->and($generalComponent)
|
2026-08-06 12:29:25 +00:00
|
|
|
->not->toContain('public function loadCurrentInternalHostname(): void')
|
|
|
|
|
->and($internalAccessComponent)
|
2026-08-05 19:24:25 +00:00
|
|
|
->toContain('public ?string $currentInternalHostname = null;')
|
|
|
|
|
->toContain('public function loadCurrentInternalHostname(): void')
|
|
|
|
|
->toContain('getCurrentApplicationContainerStatus(')
|
|
|
|
|
->toContain("data_get(\$currentContainer, 'Names')")
|
|
|
|
|
->and($configurationSidebar)
|
2026-08-06 12:29:25 +00:00
|
|
|
->toContain("['id' => 'access-section', 'label' => 'Access']");
|
2026-08-05 19:24:25 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('does not show the internal access section for Docker Compose applications', function () {
|
|
|
|
|
$generalSettings = file_get_contents(resource_path('views/livewire/project/application/general.blade.php'));
|
|
|
|
|
$configurationSidebar = file_get_contents(resource_path('views/components/application/configuration-sidebar.blade.php'));
|
|
|
|
|
|
|
|
|
|
expect($generalSettings)
|
|
|
|
|
->toContain("@if (\$buildPack !== 'dockercompose')")
|
|
|
|
|
->and($configurationSidebar)
|
2026-08-06 12:29:25 +00:00
|
|
|
->toContain("['id' => 'access-section', 'label' => 'Access']")
|
|
|
|
|
->not->toContain("['id' => 'public-access-section', 'label' => 'Public access']")
|
|
|
|
|
->not->toContain("['id' => 'internal-access-section', 'label' => 'Internal access']");
|
2026-08-05 19:24:25 +00:00
|
|
|
});
|