Files
coolify/tests/Feature/ApplicationContainerPresenceTest.php
T
Andras BacsaiandClaude Opus 5.5 a79ee909c6 chore: remove unused components and markup-only tests
- Delete Blade components, component classes, Livewire components and
  views that nothing uses after the redesign.
- Delete tests that only compare Blade/CSS source text; keep the source
  checks for authorization gates, stable wire:key values and escaping.
- Update stale tests to the current UI and behaviour.
- Update DESIGN.md to the current navigation and layout.
- Add a lesson: test behaviour, not source markup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 00:18:16 +02:00

27 lines
1.4 KiB
PHP

<?php
use App\Models\Application;
it('stores nullable application container presence as a boolean', function () {
$application = new Application;
$application->forceFill(['container_present' => 1]);
$migration = file_get_contents(base_path('database/migrations/2026_08_30_193506_add_container_present_to_applications_table.php'));
expect($application->container_present)->toBeTrue()
->and($migration)->toContain("boolean('container_present')->nullable()");
});
it('updates container presence at application lifecycle boundaries', function () {
$stopAction = file_get_contents(app_path('Actions/Application/StopApplication.php'));
$dockerStatus = file_get_contents(app_path('Actions/Docker/GetContainersStatus.php'));
$sentinelStatus = file_get_contents(app_path('Jobs/PushServerUpdateJob.php'));
expect($stopAction)->toContain('$containerPresent = ! $removeContainers;')
->and($stopAction)->toMatch('/if \(\$server->isSwarm\(\)\).*?\$containerPresent = false;.*?docker stack rm/s')
->and($stopAction)->toContain("'container_present' => \$containerPresent")
->and($dockerStatus)->toContain("'container_present' => true")
->and($dockerStatus)->toContain("'container_present' => false")
->and($sentinelStatus)->toContain("'container_present' => true")
->and($sentinelStatus)->toContain("'container_present' => false");
});