Halte Auswirkung und Rückzug beim Veröffentlichen eines Artikel-Stands fest.
Deploy Test / test (push) Successful in 12s
Deploy Test / deploy (push) Successful in 32s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-11-15 09:07:14 +01:00
1 parent fd6860efda
commit fef0ea2ac2
11 files changed
+298 -25

No files matched your search

+57
View File
@@ -189,6 +189,63 @@ public function test_h_a_bundle_change_does_not_change_an_activated_offer(): voi
$offer->save();
}
public function test_publication_records_impact_and_withdrawal_restores_the_previous_release(): void
{
$content = app(ContentService::class);
$articles = app(ArticleService::class);
$firstVersion = $this->element('Blatt', 'Fassung 1');
$article = $this->article('blatt');
$first = $articles->publishRelease($article, $firstVersion, 'Erste Einordnung.');
$article = $article->fresh();
$rights = $this->rights();
app(OfferService::class)->activate(
app(OfferService::class)->create('Blattangebot'),
[['target' => $article, 'rights' => $rights]],
);
$party = Party::query()->create([
'type' => PartyType::Person,
'display_name' => 'Mitglied Probe',
]);
$acquisition = Acquisition::query()->create([
'party_id' => $party->id,
'type' => AcquisitionType::FreierAbruf,
'reference_type' => 'offer',
'reference_id' => 1,
]);
Grant::query()->create([
'acquisition_id' => $acquisition->id,
'license_article_id' => $article->id,
'rights_profile_version_id' => $rights->id,
'rights_snapshot' => $rights->capabilities,
'release_at_grant_id' => $first->id,
'status' => GrantStatus::Aktiv,
]);
$secondVersion = $content->publishElementVersion($firstVersion->element->fresh(), 'Fassung 2');
$second = $articles->publishRelease($article->fresh(), $secondVersion, 'Überarbeitung desselben Artikels.');
$this->assertSame(1, $second->impact_report['holders']);
$this->assertSame(['Blattangebot'], $second->impact_report['offers']);
$this->assertSame(1, $second->impact_report['replaces_number']);
$content->block($secondVersion, 'Fehlerhafte Fassung.');
try {
$articles->publishRelease($article->fresh(), $secondVersion, 'Darf nicht erscheinen.');
$this->fail('Eine gesperrte Fassung darf nicht veröffentlicht werden.');
} catch (DomainRuleException) {
}
$this->assertSame($second->id, $article->fresh()->current_release_id);
$result = $articles->withdraw($article->fresh(), 'Die zweite Fassung ist fehlerhaft.');
$this->assertSame(1, $result['fallback_number']);
$this->assertSame(['Mitglied Probe'], $result['holders']);
$this->assertSame($first->id, $article->fresh()->current_release_id);
$this->assertSame('gesperrt', $second->fresh()->status->value);
}
public function test_each_holder_gets_an_own_acquisition_and_one_grant_per_article(): void
{
$article = $this->publishedArticle('frei', 'Kostenloses Blatt');