Fasse die Bearbeitung in Dialoge und übernimm eine Filmstelle als Titelbild.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
9195cdcd15
commit
c47c3b9b32
9 files changed
+1052
-228
No files matched your search
@@ -7,6 +7,7 @@
|
||||
use App\Domain\Catalog\CompositionKind;
|
||||
use App\Domain\Catalog\ContentElementVersion;
|
||||
use App\Domain\Catalog\ContentService;
|
||||
use App\Domain\Catalog\ContentVersionStatus;
|
||||
use App\Filament\Pages\EditorialDesk;
|
||||
use App\Filament\Resources\Courses\CourseResource;
|
||||
use App\Filament\Resources\Courses\Pages\EditCourse;
|
||||
@@ -337,6 +338,8 @@ public function test_catalog_cards_show_text_status_and_a_single_film_suggestion
|
||||
->assertSee('In Mitgliederbibliothek anzeigen')
|
||||
->assertSee('Vorschlag aus dem Film Lara im Park')
|
||||
->assertSee('Katalogvorschau')
|
||||
->assertSee('Modul bearbeiten')
|
||||
->assertDontSee('Anzeige speichern')
|
||||
->assertDontSee('Zur Anzeige freigeben');
|
||||
}
|
||||
|
||||
@@ -357,8 +360,15 @@ public function test_a_chosen_picture_and_description_do_not_create_a_version():
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditExercise::class, ['record' => $version->composition_id])
|
||||
->assertSee('Lara im Park als Titelbild')
|
||||
->assertSee('Lara im Hof als Titelbild')
|
||||
->call('openModule')
|
||||
->set('moduleTab', 'titelbild')
|
||||
->assertSee('Aus Film')
|
||||
->assertSee('Vorhandenes Bild')
|
||||
->assertSee('Hochladen')
|
||||
->assertSee('Lara im Park')
|
||||
->assertSee('Lara im Hof')
|
||||
->assertDontSee('Anzeige speichern')
|
||||
->assertDontSee('Titelbild speichern')
|
||||
->assertDontSee('Vorschlag aus dem Film')
|
||||
->call('adoptPicture', $first->element->id)
|
||||
->assertSet('feedback', 'Das Vorschaubild ist gespeichert. Die Fassung bleibt unverändert.')
|
||||
@@ -377,6 +387,145 @@ public function test_a_chosen_picture_and_description_do_not_create_a_version():
|
||||
$this->get('/medien/'.$composition->thumbnail_path)->assertNotFound();
|
||||
}
|
||||
|
||||
public function test_the_module_dialog_saves_text_without_a_new_version(): void
|
||||
{
|
||||
$content = app(ContentService::class);
|
||||
$sheet = $content->publishElementVersion($content->createElement('text', 'text', 'Blatt'), 'Hinweis');
|
||||
$version = $content->publishComposition(
|
||||
$content->createComposition('Dialog Modul', CompositionKind::Uebung),
|
||||
[['role' => 'Unterlage', 'target' => $sheet]],
|
||||
);
|
||||
$editor = $this->editor();
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditExercise::class, ['record' => $version->composition_id])
|
||||
->assertDontSee('Anzeige speichern')
|
||||
->call('openModule')
|
||||
->assertSee('Beschreibung')
|
||||
->assertSee('Didaktik')
|
||||
->assertSee('Einordnung')
|
||||
->assertSee('Titelbild')
|
||||
->set('description', 'Weg damit')
|
||||
->call('closeModule')
|
||||
->assertSet('description', '');
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditExercise::class, ['record' => $version->composition_id])
|
||||
->set('description', 'Ausführlicher Dialogtext')
|
||||
->set('summary', 'Kurzer Dialogtext')
|
||||
->call('saveModule')
|
||||
->assertSet('moduleOpen', false)
|
||||
->assertSee('Es entsteht keine neue Fassung');
|
||||
|
||||
$composition = $version->composition->fresh();
|
||||
$this->assertSame(1, $composition->versions()->count());
|
||||
$this->assertSame('Ausführlicher Dialogtext', $composition->description);
|
||||
$this->assertNull($composition->working_draft);
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditExercise::class, ['record' => $version->composition_id])
|
||||
->set('learningGoal', 'Nur im Entwurf')
|
||||
->set('durationMinutes', '9')
|
||||
->call('saveModule');
|
||||
|
||||
$composition->refresh();
|
||||
$this->assertSame(1, $composition->versions()->count());
|
||||
$this->assertSame(ContentVersionStatus::Bereit, $composition->versions()->first()->status);
|
||||
$this->assertSame('Nur im Entwurf', $composition->working_draft['learning_goal']);
|
||||
$this->assertSame(9, $composition->working_draft['duration_minutes']);
|
||||
}
|
||||
|
||||
public function test_the_picker_groups_versions_and_adopts_the_chosen_one(): void
|
||||
{
|
||||
$content = app(ContentService::class);
|
||||
$element = $content->createElement('film', 'film', 'Lara im Park');
|
||||
$first = $content->publishElementVersion($element, 'Erste Stelle');
|
||||
$second = $content->publishElementVersion($element, 'Zweite Stelle');
|
||||
$module = $content->createComposition('Fassungswahl', CompositionKind::Uebung);
|
||||
|
||||
$component = Livewire::actingAs($this->editor(), 'staff')
|
||||
->test(EditExercise::class, ['record' => $module->id])
|
||||
->call('openPicker')
|
||||
->set('pickerQuery', 'Lara')
|
||||
->set('pickerSelected', 'element:'.$second->id);
|
||||
|
||||
$items = $component->instance()->pickerResult()['items'];
|
||||
$this->assertCount(1, $items);
|
||||
$this->assertSame('element:'.$second->id, $items[0]['target']);
|
||||
|
||||
$component
|
||||
->assertSee('Fassung 1')
|
||||
->assertSee('aktueller Stand')
|
||||
->set('pickerSelected', 'element:'.$first->id)
|
||||
->call('addPart', 'element:'.$first->id);
|
||||
$module->refresh();
|
||||
$this->assertSame(0, $module->versions()->count());
|
||||
$this->assertSame('element:'.$first->id, $module->working_draft['members'][0]['target']);
|
||||
}
|
||||
|
||||
public function test_the_part_dialog_saves_a_role_without_a_new_version(): void
|
||||
{
|
||||
$content = app(ContentService::class);
|
||||
$sheet = $content->publishElementVersion($content->createElement('text', 'text', 'Blatt'), 'Hinweis');
|
||||
$version = $content->publishComposition(
|
||||
$content->createComposition('Rollendialog', CompositionKind::Uebung),
|
||||
[['role' => 'Unterlage', 'target' => $sheet]],
|
||||
);
|
||||
|
||||
Livewire::actingAs($this->editor(), 'staff')
|
||||
->test(EditExercise::class, ['record' => $version->composition_id])
|
||||
->call('openPart', 0)
|
||||
->assertSee('Bestandteil bearbeiten')
|
||||
->set('roleDraft', 'Einstieg')
|
||||
->call('savePart')
|
||||
->assertSet('partOpen', false)
|
||||
->assertSee('Es entsteht keine neue Fassung');
|
||||
|
||||
$composition = $version->composition->fresh();
|
||||
$this->assertSame(1, $composition->versions()->count());
|
||||
$this->assertSame('Unterlage', $composition->versions()->first()->members()->first()->role);
|
||||
$this->assertSame('Einstieg', $composition->working_draft['members'][0]['role']);
|
||||
}
|
||||
|
||||
public function test_a_missing_film_frame_does_not_create_a_version(): void
|
||||
{
|
||||
Storage::fake('media_derived');
|
||||
$content = app(ContentService::class);
|
||||
$element = $content->createElement('film', 'film', 'Lara im Park');
|
||||
$film = $content->publishElementVersion($element, null, ['file' => 'inhalte/lara.mp4']);
|
||||
$version = $content->publishComposition(
|
||||
$content->createComposition('Rahmen Modul', CompositionKind::Uebung),
|
||||
[['role' => 'Film', 'target' => $film]],
|
||||
);
|
||||
$editor = $this->editor();
|
||||
|
||||
$this->get(route('editorial.frame', ['version' => $film, 'sekunde' => '4.5']))
|
||||
->assertRedirect();
|
||||
$this->actingAs($editor, 'staff')
|
||||
->get(route('editorial.frame', ['version' => $film, 'sekunde' => '4.5']))
|
||||
->assertNotFound();
|
||||
$this->actingAs($editor, 'staff')
|
||||
->get(route('editorial.frame', ['version' => $film, 'sekunde' => 'nein']))
|
||||
->assertNotFound();
|
||||
|
||||
Livewire::actingAs($editor, 'staff')
|
||||
->test(EditExercise::class, ['record' => $version->composition_id])
|
||||
->call('openModule')
|
||||
->set('imageMode', 'film')
|
||||
->set('frameVersionId', $film->id)
|
||||
->set('frameSecond', '4.5')
|
||||
->call('saveModule')
|
||||
->assertSet('moduleOpen', true);
|
||||
|
||||
$composition = $version->composition->fresh();
|
||||
$film->refresh();
|
||||
$this->assertSame(1, $composition->versions()->count());
|
||||
$this->assertNull($composition->thumbnail_path);
|
||||
$this->assertNotNull($composition->thumbnail_error);
|
||||
$this->assertSame('inhalte/lara.mp4', $film->metadata['file']);
|
||||
Storage::disk('media_derived')->assertMissing('inhalte/lara.mp4');
|
||||
}
|
||||
|
||||
private function filmWithPicture(ContentService $content, string $title): ContentElementVersion
|
||||
{
|
||||
$element = $content->createElement('film', 'film', $title);
|
||||
|
||||
Reference in new issue
Block a user