Fix share assets, shared photo UI, and live show expiry
This commit is contained in:
@@ -10,6 +10,7 @@ use App\Models\Tenant;
|
||||
use App\Services\EventJoinTokenService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PhotoShareLinkTest extends TestCase
|
||||
@@ -64,13 +65,18 @@ class PhotoShareLinkTest extends TestCase
|
||||
|
||||
public function test_share_payload_exposes_public_photo_data(): void
|
||||
{
|
||||
Config::set('filesystems.default', 'public');
|
||||
Storage::fake('public');
|
||||
$tenant = Tenant::factory()->create();
|
||||
$event = Event::factory()->for($tenant)->create(['status' => 'published']);
|
||||
$task = Task::factory()->for($tenant)->create();
|
||||
$photo = Photo::factory()->for($event)->create([
|
||||
'status' => 'approved',
|
||||
'task_id' => $task->id,
|
||||
'file_path' => 'photos/share-test.jpg',
|
||||
'thumbnail_path' => 'photos/thumbnails/share-test.jpg',
|
||||
]);
|
||||
Storage::disk('public')->put('photos/share-test.jpg', 'photo');
|
||||
|
||||
$share = PhotoShareLink::factory()->for($photo)->create([
|
||||
'expires_at' => now()->addDay(),
|
||||
@@ -95,5 +101,16 @@ class PhotoShareLinkTest extends TestCase
|
||||
'buttons',
|
||||
],
|
||||
]);
|
||||
|
||||
$assetUrl = $response->json('photo.image_urls.full');
|
||||
$this->assertIsString($assetUrl);
|
||||
$this->assertNotNull(parse_url($assetUrl, PHP_URL_SCHEME));
|
||||
|
||||
$parsed = parse_url($assetUrl);
|
||||
$path = (string) ($parsed['path'] ?? '');
|
||||
$query = $parsed['query'] ?? null;
|
||||
|
||||
$assetResponse = $this->get($path.($query ? "?{$query}" : ''));
|
||||
$assetResponse->assertOk();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user