Zeige Nutzbarkeit, Didaktik und oeffentliche Programmfassung
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
5e763d15ec
commit
c99a957e6f
17 files changed
+307
-6
No files matched your search
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Domain\Catalog\ArticleService;
|
||||
use App\Domain\Catalog\CompositionDisplayRelease;
|
||||
use App\Domain\Catalog\ContentService;
|
||||
use App\Domain\Catalog\EditorialContentKind;
|
||||
use App\Domain\Catalog\OfferService;
|
||||
use App\Domain\Entitlement\GrantIssuer;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class LibraryCompletionTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_didactic_fields_partial_coverage_and_public_page_follow_the_released_version(): void
|
||||
{
|
||||
$content = app(ContentService::class);
|
||||
$film = $content->publishElementVersion($content->createElement('film', 'film', 'Hof'), null, ['file' => 'inhalte/hof.mp4']);
|
||||
$sheet = $content->publishElementVersion($content->createElement('text', 'document', 'Blatt'), 'Text');
|
||||
$programm = EditorialContentKind::query()->where('slug', 'programm')->firstOrFail();
|
||||
$version = $content->publishComposition(
|
||||
tap($content->createComposition('Öffentliches Programm'), function ($item) use ($programm): void {
|
||||
$item->editorial_content_kind_id = $programm->id;
|
||||
$item->thumbnail_error = 'Kein Bild erzeugt.';
|
||||
$item->save();
|
||||
}),
|
||||
[
|
||||
['role' => 'Film', 'target' => $film],
|
||||
['role' => 'Blatt', 'target' => $sheet],
|
||||
],
|
||||
null,
|
||||
null,
|
||||
['learning_goal' => 'Abstand halten', 'duration_minutes' => 20, 'material_note' => 'Ein Blatt'],
|
||||
);
|
||||
$articles = app(ArticleService::class);
|
||||
$filmArticle = $articles->create('nur-film-fertig');
|
||||
$articles->publishRelease($filmArticle, $film, 'Nur Film.');
|
||||
$offers = app(OfferService::class);
|
||||
$rights = $offers->createRightsProfile('Film', 'ehrenamtlich', ['film' => ['streamen']]);
|
||||
$offer = $offers->create('Teilprogramm');
|
||||
$offers->activate($offer, [['target' => $filmArticle->fresh(), 'rights' => $rights]], ['grant_kind' => 'auf_abruf']);
|
||||
$member = User::factory()->create();
|
||||
app(GrantIssuer::class)->claim($member, $offer);
|
||||
app(CompositionDisplayRelease::class)->release($version, $member);
|
||||
|
||||
$this->actingAs($member)->get(route('member.program', $version->composition))
|
||||
->assertOk()
|
||||
->assertSee('teilweise')
|
||||
->assertSee('Abstand halten')
|
||||
->assertSee('Kein Bild erzeugt.')
|
||||
->assertSee('Platzhalter');
|
||||
|
||||
$this->get(route('public.program', $version->composition))
|
||||
->assertOk()
|
||||
->assertSee('Öffentliches Programm')
|
||||
->assertSee('Abstand halten')
|
||||
->assertDontSee('inhalte/hof.mp4');
|
||||
|
||||
$this->get('/medien/bibliothek/geheim.jpg')->assertNotFound();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user