Ordne Übungsabschnitte im Medienbestand ein und filtere Materialarten mehrfach
Deploy Test / test (push) Successful in 2m51s
CI Feature / test (push) Successful in 2m49s
Deploy Test / deploy (push) Successful in 35s

- Medium anlegen: Pflichtfeld Fachliche Materialart (serverseitig geprüft)
- Materialart Übungsabschnitt (automatisch) für Abschnitte im Übungseditor und aus Shinkan, mit Verweis auf die Übung
- Medienmanager: Checkboxen statt Dropdown, Start ohne Übungsabschnitte, persönlicher Standard je Konto
- Zuordnung des Bestands nur bei belegter Herkunft; Übungsabschnitte nie öffentlich

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 5.5 committed 2026-11-24 07:40:30 +01:00
1 parent 99122ddfee
commit ad581cb545
29 files changed
+1321 -25

No files matched your search

+45
View File
@@ -8,6 +8,7 @@
use App\Domain\Catalog\CompositionKind;
use App\Domain\Catalog\ContentService;
use App\Domain\Catalog\ExerciseGuide;
use App\Domain\Catalog\ExerciseSections;
use App\Domain\Catalog\LicenseArticle;
use App\Domain\Catalog\OfferService;
use App\Domain\Catalog\RightsProfileVersion;
@@ -242,6 +243,50 @@ public function test_the_stand_keeps_what_was_chosen_when_a_newer_exercise_versi
->assertSee('Nein sagen und Abstand halten');
}
public function test_two_product_stands_show_their_own_text_versions_and_an_exercise_of_sections_only_gives_a_pdf(): void
{
$content = app(ContentService::class);
$articles = app(ArticleService::class);
$exercise = $this->exerciseComposition('Nur Abschnitte');
$section = $this->section('Ablauf', '<p>Stand eins des Abschnitts.</p>');
app(ExerciseSections::class)->mark($section->element, $exercise);
$first = $content->publishComposition($exercise, [['role' => 'Durchführung', 'target' => $section]]);
$moduleOne = $this->moduleWith('Modul eins', $first);
$articleOne = $articles->create('nur-abschnitte-eins');
$releaseOne = $articles->publishRelease($articleOne, $moduleOne, 'Eins.');
$revised = $content->publishElementVersion($section->element, '<p>Stand zwei des Abschnitts.</p>');
$second = $content->publishComposition($exercise, [['role' => 'Durchführung', 'target' => $revised]]);
$moduleTwo = $this->moduleWith('Modul zwei', $second);
$articleTwo = $articles->create('nur-abschnitte-zwei');
$releaseTwo = $articles->publishRelease($articleTwo, $moduleTwo, 'Zwei.');
// Der Abschnitt wird außerdem direkt in einem Modul verwendet und bleibt dort erreichbar.
$direct = $this->moduleWith('Modul direkt', $second, null, CompositionKind::Uebung, $revised);
$articleDirect = $articles->create('nur-abschnitte-direkt');
$articles->publishRelease($articleDirect, $direct, 'Direkt.');
$member = $this->grantTo($this->full(), [$articleOne, $articleTwo, $articleDirect]);
$this->actingAs($member)->get($this->page($articleOne, $releaseOne))->assertOk()
->assertSee('Stand eins des Abschnitts.')->assertDontSee('Stand zwei des Abschnitts.');
$this->actingAs($member)->get($this->page($articleTwo, $releaseTwo))->assertOk()
->assertSee('Stand zwei des Abschnitts.')->assertDontSee('Stand eins des Abschnitts.');
$pdfOne = $this->actingAs($member)->get($this->pdf($articleOne, $releaseOne, null, $member));
$pdfOne->assertOk()->assertHeader('Content-Type', 'application/pdf');
$this->assertStringContainsString('Stand eins des Abschnitts.', $this->pdfText($pdfOne->getContent()));
$this->assertStringNotContainsString('Stand zwei', $this->pdfText($pdfOne->getContent()));
$this->assertStringContainsString('Stand zwei des Abschnitts.', $this->pdfText($this->actingAs($member)->get($this->pdf($articleTwo, $releaseTwo, null, $member))->getContent()));
app(CompositionDisplayRelease::class)->release($direct, $member);
$page = $this->actingAs($member)
->get(route('member.content', ['composition' => $direct->composition_id, 'version' => $revised->id]))
->assertOk()
->assertSee('Ablauf');
$this->assertSame(1, preg_match('#href="([^"]+/ansehen\?[^"]+)"#', $page->getContent(), $link), 'Die Seite bietet „Ansehen“ an.');
$this->actingAs($member)->get(html_entity_decode($link[1]))->assertOk()->assertSee('Stand zwei des Abschnitts.');
}
public function test_a_wrong_path_is_not_found(): void
{
$this->actingAs($this->member)->get(route('member.exercise', ['article' => $this->moduleArticle, 'release' => $this->moduleRelease, 'path' => '7']))->assertNotFound();