Files
coolify/tests/Unit/DatabaseStartJobTest.php
T
Andras Bacsai 1f4006ac49 test: remove tests that do not exercise app code
Remove tests that copy app logic into the test, grep PHP source as
text, only check literals, constants, class_exists or PHP built-ins,
duplicate other tests, or are always skipped. Keep source checks that
guard security and authorization rules.

Rename a duplicate Pest helper so the full suite loads, drop the
missing v5/Browser path, and remove the CLAUDE.md symlink in favor of
AGENTS.md. Correct AGENTS.md: Dusk is not installed and the upgrade
script is scripts/upgrade.sh.
2026-09-28 11:55:56 +02:00

29 lines
788 B
PHP

<?php
use App\Events\DatabaseStatusChanged;
use App\Jobs\DatabaseStartJob;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Event;
use Tests\TestCase;
uses(TestCase::class, RefreshDatabase::class);
it('broadcasts failed database starts to the initiating user even when the activity is missing', function () {
Event::fake([DatabaseStatusChanged::class]);
$job = new DatabaseStartJob(
databaseClass: 'MissingDatabase',
databaseId: 123,
teamId: 456,
activityId: 789,
userId: 42,
);
$job->failed(new RuntimeException('Database start failed.'));
Event::assertDispatched(
DatabaseStatusChanged::class,
fn (DatabaseStatusChanged $event): bool => $event->userId === 42,
);
});