updated table structure for photobooth/sparkbooth settings. now there's a separate table for it. update all references and tests. also fixed the notification panel and the lightbox in the guest app.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace Tests\Feature\Photobooth;
|
||||
|
||||
use App\Models\Event;
|
||||
use App\Models\EventPhotoboothSetting;
|
||||
use App\Models\PhotoboothSetting;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use PHPUnit\Framework\Attributes\Test;
|
||||
@@ -58,11 +59,13 @@ class PhotoboothControllerTest extends TenantTestCase
|
||||
->assertJsonPath('data.username', fn ($value) => is_string($value) && strlen($value) <= 10);
|
||||
|
||||
$event->refresh();
|
||||
$this->assertTrue($event->photobooth_enabled);
|
||||
$this->assertNotNull($event->photobooth_username);
|
||||
$this->assertNotNull($event->photobooth_password);
|
||||
$username = $event->photobooth_username;
|
||||
$firstPassword = $event->photobooth_password;
|
||||
$setting = $event->photoboothSetting;
|
||||
$this->assertNotNull($setting);
|
||||
$this->assertTrue($setting->enabled);
|
||||
$this->assertNotNull($setting->username);
|
||||
$this->assertNotNull($setting->password);
|
||||
$username = $setting->username;
|
||||
$firstPassword = $setting->password;
|
||||
|
||||
Http::assertSent(fn ($request) => $request->url() === 'https://control.test/users' && $request['username'] === $username);
|
||||
|
||||
@@ -72,7 +75,7 @@ class PhotoboothControllerTest extends TenantTestCase
|
||||
->assertJsonPath('data.enabled', true);
|
||||
|
||||
$event->refresh();
|
||||
$this->assertNotSame($firstPassword, $event->photobooth_password);
|
||||
$this->assertNotSame($firstPassword, $event->photoboothSetting?->password);
|
||||
|
||||
Http::assertSent(fn ($request) => $request->url() === "https://control.test/users/{$username}/rotate");
|
||||
}
|
||||
@@ -82,14 +85,18 @@ class PhotoboothControllerTest extends TenantTestCase
|
||||
{
|
||||
$event = Event::factory()->for($this->tenant)->create([
|
||||
'slug' => 'photobooth-disable',
|
||||
'photobooth_enabled' => true,
|
||||
'photobooth_username' => 'pb123456',
|
||||
'photobooth_path' => '/photobooth/demo',
|
||||
'photobooth_status' => 'active',
|
||||
'photobooth_expires_at' => now()->subDay(),
|
||||
]);
|
||||
$event->photobooth_password = 'SECRET12';
|
||||
$event->save();
|
||||
EventPhotoboothSetting::factory()
|
||||
->for($event)
|
||||
->create([
|
||||
'enabled' => true,
|
||||
'mode' => 'ftp',
|
||||
'username' => 'pb123456',
|
||||
'password' => 'SECRET12',
|
||||
'path' => '/photobooth/demo',
|
||||
'status' => 'active',
|
||||
'expires_at' => now()->subDay(),
|
||||
]);
|
||||
|
||||
Http::fake([
|
||||
'https://control.test/*' => Http::response(['ok' => true], 200),
|
||||
@@ -102,8 +109,8 @@ class PhotoboothControllerTest extends TenantTestCase
|
||||
->assertJsonPath('data.username', null);
|
||||
|
||||
$event->refresh();
|
||||
$this->assertFalse($event->photobooth_enabled);
|
||||
$this->assertNull($event->photobooth_username);
|
||||
$this->assertFalse($event->photoboothSetting?->enabled);
|
||||
$this->assertNull($event->photoboothSetting?->username);
|
||||
|
||||
Http::assertSent(fn ($request) => $request->url() === 'https://control.test/users/pb123456');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user