added a help system, replaced the words "tenant" and "Pwa" with better alternatives. corrected and implemented cron jobs. prepared going live on a coolify-powered system.
This commit is contained in:
51
tests/Feature/Console/PhotoboothCleanupCommandTest.php
Normal file
51
tests/Feature/Console/PhotoboothCleanupCommandTest.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Console;
|
||||
|
||||
use App\Models\Event;
|
||||
use App\Models\PhotoboothSetting;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PhotoboothCleanupCommandTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_command_disables_expired_accounts(): void
|
||||
{
|
||||
config([
|
||||
'photobooth.control_service.base_url' => 'https://control.test',
|
||||
'photobooth.control_service.token' => 'secret-token',
|
||||
]);
|
||||
|
||||
PhotoboothSetting::current()->update([
|
||||
'control_service_base_url' => 'https://control.test',
|
||||
]);
|
||||
|
||||
$event = Event::factory()->create([
|
||||
'photobooth_enabled' => true,
|
||||
'photobooth_username' => 'pbcleanup',
|
||||
'photobooth_status' => 'active',
|
||||
'photobooth_path' => '/photobooth/demo',
|
||||
'photobooth_expires_at' => now()->subDay(),
|
||||
]);
|
||||
$event->photobooth_password = 'CLEANUP';
|
||||
$event->save();
|
||||
|
||||
Http::fake([
|
||||
'https://control.test/*' => Http::response(['ok' => true], 200),
|
||||
]);
|
||||
|
||||
$this->artisan('photobooth:cleanup-expired')
|
||||
->assertExitCode(0);
|
||||
|
||||
$event->refresh();
|
||||
|
||||
$this->assertFalse($event->photobooth_enabled);
|
||||
$this->assertNull($event->photobooth_username);
|
||||
$this->assertNotNull($event->photobooth_last_deprovisioned_at);
|
||||
|
||||
Http::assertSent(fn ($request) => $request->url() === 'https://control.test/users/pbcleanup');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user