Zeige Medienfassungen in der Verwaltung und halte Beschreibungen davon getrennt.
Deploy Test / test (push) Successful in 15s
Deploy Test / deploy (push) Successful in 22s

Eine Fassung bleibt nummeriert und kann deaktiviert werden. Beschreibung und fachliche Säulen gehören zum Medium und legen keine neue Fassung an.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-15 11:25:08 +01:00
1 parent 12f12117dd
commit af85a94cd5
28 files changed
+1002 -168

No files matched your search

+3 -1
View File
@@ -96,8 +96,10 @@ public function test_catalog_pages_show_contents_packages_and_resolved_rights():
$sheet->load('element');
$this->actingAs($editor, 'staff')
->get(ContentElementResource::getUrl('edit', ['record' => $sheet->element]))
->get(ContentElementResource::getUrl('view', ['record' => $sheet->element]))
->assertOk()
->assertSee('Hinweis für die Prüfung.')
->assertSee('Fassung 1')
->assertSee('Übung: Übung Alltag')
->assertSee('Lizenzartikel demo-merkblatt')
->assertSee('Neue Fassung anlegen');
+59 -7
View File
@@ -7,6 +7,7 @@
use App\Filament\Resources\Combinations\CombinationResource;
use App\Filament\Resources\ContentElements\ContentElementResource;
use App\Filament\Resources\ContentElements\Pages\EditContentElement;
use App\Filament\Resources\ContentElements\Pages\ViewContentElement;
use App\Filament\Resources\Courses\CourseResource;
use App\Filament\Resources\Exercises\ExerciseResource;
use App\Filament\Resources\Exercises\Pages\EditExercise;
@@ -39,15 +40,14 @@ public function test_a_medium_keeps_the_old_version_when_a_new_one_is_saved(): v
$editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
$this->actingAs($editor, 'staff');
Livewire::test(EditContentElement::class, ['record' => $element->getKey()])
Livewire::test(ViewContentElement::class, ['record' => $element->getKey()])
->assertOk()
->assertSee('Erste Fassung')
->fillForm([
'working_title' => 'Merkblatt',
->assertSee('Fassung 1')
->callAction('revise', [
'body' => 'Zweite Fassung',
'change_note' => 'Korrektur',
])
->call('save')
->assertHasNoFormErrors();
$versions = $element->versions()->orderBy('number')->get();
@@ -69,14 +69,13 @@ public function test_an_uploaded_file_becomes_a_ready_version(): void
$editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
$this->actingAs($editor, 'staff');
Livewire::test(EditContentElement::class, ['record' => $element->getKey()])
->fillForm([
Livewire::test(ViewContentElement::class, ['record' => $element->getKey()])
->callAction('revise', [
'working_title' => 'Übungsfilm',
'body' => 'Anleitung zum Film',
'incoming' => ['inhalte/film.mp4'],
'decision_seconds' => 12,
])
->call('save')
->assertHasNoFormErrors();
$version = $element->versions()->first();
@@ -150,5 +149,58 @@ public function test_a_catalog_keeper_cannot_edit_media(): void
$this->actingAs($keeper, 'staff')
->get(ContentElementResource::getUrl('edit', ['record' => $element]))
->assertForbidden();
$version = app(ContentService::class)->publishElementVersion($element, 'Sichtbarer Text');
$this->actingAs($keeper, 'staff')
->get(ContentElementResource::getUrl('view', ['record' => $element]))
->assertOk()
->assertSee('Fassung 1')
->assertSee('Sichtbarer Text')
->assertDontSee('Beschreibung ändern');
}
public function test_a_description_does_not_create_a_version_and_an_older_version_can_be_deactivated(): void
{
Storage::fake('media_derived');
Storage::disk('media_derived')->put('inhalte/film.mp4', 'filmbytes');
$content = app(ContentService::class);
$element = $content->createElement('film', 'film', 'Übungsfilm');
$first = $content->publishElementVersion($element, 'Erste Fassung', ['file' => 'inhalte/film.mp4']);
$second = $content->publishElementVersion($element, 'Zweite Fassung', ['file' => 'inhalte/film.mp4']);
$editor = User::factory()->redakteur()->create();
$editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
$this->actingAs($editor, 'staff');
Livewire::test(EditContentElement::class, ['record' => $element->getKey()])
->fillForm([
'working_title' => 'Übungsfilm',
'description' => 'Für die Gruppe',
'pillars' => [],
])
->call('save')
->assertHasNoFormErrors();
$this->assertSame(2, $element->versions()->count());
$this->assertSame('Für die Gruppe', $element->fresh()->description);
Livewire::test(ViewContentElement::class, ['record' => $element->getKey()])
->assertSee('Fassung 1')
->assertSee('Fassung 2')
->assertSee('<video', false)
->assertSee(route('content.file', $second), false)
->callAction('deactivate', ['reason' => 'Veraltet'], ['version' => $first->id])
->assertHasNoFormErrors()
->assertSee('deaktiviert');
$first->refresh();
$this->assertSame(ContentVersionStatus::Gesperrt, $first->status);
$this->assertSame('Veraltet', $first->block_reason);
$this->assertSame(ContentVersionStatus::Bereit, $element->versions()->where('number', 2)->first()->status);
$this->actingAs($editor, 'staff')
->get(route('content.file', $first))
->assertOk();
}
}
+74
View File
@@ -0,0 +1,74 @@
<?php
namespace Tests\Feature;
use App\Domain\Catalog\CompositionKind;
use App\Domain\Catalog\ContentService;
use App\Domain\Catalog\DomainRuleException;
use App\Domain\Catalog\PillarService;
use App\Filament\Resources\Pillars\PillarResource;
use App\Filament\Support\CatalogReading;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class PillarAssignmentTest extends TestCase
{
use RefreshDatabase;
public function test_a_medium_can_belong_to_several_pillars_and_a_course_keeps_them(): void
{
$pillars = app(PillarService::class);
$grenzen = $pillars->create('Grenzen');
$hilfe = $pillars->create('Hilfe holen');
$pillars->create('Alltag');
$content = app(ContentService::class);
$filmElement = $content->createElement('film', 'film', 'Film');
$film = $content->publishElementVersion($filmElement, 'Text');
$sheet = $content->publishElementVersion($content->createElement('pdf', 'pdf', 'Blatt'), 'Hinweis');
$pillars->assign($filmElement, [$hilfe->id, $grenzen->id]);
$pillars->assign($sheet->element, [$grenzen->id]);
$this->assertSame(1, $filmElement->versions()->count());
$this->assertSame(['Grenzen', 'Hilfe holen'], $filmElement->pillars()->pluck('name')->all());
$exercise = $content->publishComposition(
$content->createComposition('Übung Grenzen', CompositionKind::Uebung),
[
['role' => 'Film', 'target' => $film],
['role' => 'Blatt', 'target' => $sheet],
],
);
$course = $content->publishComposition(
$content->createComposition('Kurs Alltag', CompositionKind::Kurs),
[['role' => 'Übung', 'target' => $exercise]],
);
$this->assertSame([
'Film — Grenzen, Hilfe holen',
'Blatt — Grenzen',
], app(CatalogReading::class)->memberPillars($course->composition));
$editor = User::factory()->redakteur()->create();
$editor->saveAppAuthenticationSecret('JBSWY3DPEHPK3PXP');
$this->actingAs($editor, 'staff')
->get(PillarResource::getUrl('index'))
->assertOk()
->assertSee('Grenzen')
->assertSee('Alltag')
->assertSee('weitere hinzukommen');
}
public function test_a_pillar_with_media_cannot_be_deleted(): void
{
$pillars = app(PillarService::class);
$pillar = $pillars->create('Grenzen');
$element = app(ContentService::class)->createElement('text', 'text', 'Hinweis');
$pillars->assign($element, [$pillar->id]);
$this->expectException(DomainRuleException::class);
$pillars->delete($pillar);
}
}