pp-planer/tests/Feature/ExportProFileUploadTest.php
Thorsten Bus d5f3990f3b fix: login redirect, nametag/worship resolution, macros, export headers & probundle
- Post-login (OAuth + dev-login) now redirects to the next upcoming
  service's edit page instead of /dashboard, mirroring the GET / route.
- NameTagResolver now reads the real ChurchTools `responsible` shape
  (persons[].person.title) and resolves moderator/preacher/worship-leader
  by responsible ROLE ([Moderation]/[Predigt]/[Lobpreis]). This fixes
  missing name slides and makes the worship-leader arrangement trigger
  (e.g. service 12 → "Benedikt Hardt" / "Jennifer Schneider").
- NameTagSlideBuilder no longer silently drops the name slide when the
  configured macro id points to a missing macro; it emits the slide
  without a macro instead.
- Song export: the "first slide" / "last slide" macro now applies only to
  the song's very first/last slide (global slide index across all
  sections), not the first slide of every section.
- Export "headlines" for content-less agenda items are now emitted as
  proper ProPresenter playlist HEADER items instead of text presentations.
- Prefix/postfix export files now also accept .probundle (unzipped: inner
  .pro + media embedded) in addition to .pro, both for upload validation
  and export injection.

Full suite green (587 passed).
2026-06-01 22:17:31 +02:00

103 lines
3.2 KiB
PHP

<?php
namespace Tests\Feature;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Tests\TestCase;
final class ExportProFileUploadTest extends TestCase
{
use RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
Storage::fake('local');
}
public function test_pro_datei_wird_als_prefix_akzeptiert(): void
{
$user = User::factory()->create();
$file = UploadedFile::fake()->create('intro.pro', 10, 'application/octet-stream');
$response = $this->actingAs($user)->post(route('settings.export-pro-files.store'), [
'type' => 'prefix',
'files' => [$file],
]);
$response->assertStatus(201);
$response->assertJsonPath('files.0.original_name', 'intro.pro');
}
public function test_probundle_datei_wird_als_prefix_akzeptiert(): void
{
$user = User::factory()->create();
$file = UploadedFile::fake()->create('intro.probundle', 10, 'application/octet-stream');
$response = $this->actingAs($user)->post(route('settings.export-pro-files.store'), [
'type' => 'prefix',
'files' => [$file],
]);
$response->assertStatus(201);
$response->assertJsonPath('files.0.original_name', 'intro.probundle');
}
public function test_pro_datei_wird_als_postfix_akzeptiert(): void
{
$user = User::factory()->create();
$file = UploadedFile::fake()->create('outro.pro', 10, 'application/octet-stream');
$response = $this->actingAs($user)->post(route('settings.export-pro-files.store'), [
'type' => 'postfix',
'files' => [$file],
]);
$response->assertStatus(201);
$response->assertJsonPath('files.0.original_name', 'outro.pro');
}
public function test_probundle_datei_wird_als_postfix_akzeptiert(): void
{
$user = User::factory()->create();
$file = UploadedFile::fake()->create('outro.probundle', 10, 'application/octet-stream');
$response = $this->actingAs($user)->post(route('settings.export-pro-files.store'), [
'type' => 'postfix',
'files' => [$file],
]);
$response->assertStatus(201);
$response->assertJsonPath('files.0.original_name', 'outro.probundle');
}
public function test_unerlaubte_dateiendung_wird_abgelehnt(): void
{
$user = User::factory()->create();
$file = UploadedFile::fake()->create('document.txt', 10, 'text/plain');
$response = $this->actingAs($user)->postJson(route('settings.export-pro-files.store'), [
'type' => 'prefix',
'files' => [$file],
]);
$response->assertStatus(422);
}
public function test_unerlaubte_dateiendung_postfix_wird_abgelehnt(): void
{
$user = User::factory()->create();
$file = UploadedFile::fake()->create('document.txt', 10, 'text/plain');
$response = $this->actingAs($user)->postJson(route('settings.export-pro-files.store'), [
'type' => 'postfix',
'files' => [$file],
]);
$response->assertStatus(422);
}
}