Titelbild: Bildnachweis als Pflichtfeld, Lizenzdetail-Reset bei Typwechsel

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-06-12 15:44:52 +00:00
parent a7c30d4ecc
commit 6e0b2b1814
3 changed files with 371 additions and 150 deletions

View file

@ -226,6 +226,7 @@ test('valid cc upload stores license detail and license url', function () {
LivewireVolt::test('components.press-release-images-manager', ['pressReleaseId' => $pr->id])
->set('newImage', UploadedFile::fake()->image('foto.jpg', 1200, 800))
->set('newAuthor', 'Jane Doe')
->set('newCopyright', 'Foto: Jane Doe (CC BY 4.0)')
->set('newLicenseType', ImageLicenseType::CreativeCommons->value)
->set('newLicenseDetail', 'cc_by')
->set('newLicenseUrl', 'https://creativecommons.org/licenses/by/4.0/')
@ -243,6 +244,34 @@ test('valid cc upload stores license detail and license url', function () {
expect($image->license_url)->toBe('https://creativecommons.org/licenses/by/4.0/');
});
test('the public image credit is required', function () {
/** @var TestCase $this */
['owner' => $owner, 'pr' => $pr] = makeImageDraftOwner();
$this->actingAs($owner);
LivewireVolt::test('components.press-release-images-manager', ['pressReleaseId' => $pr->id])
->set('newImage', UploadedFile::fake()->image('foto.jpg', 1200, 800))
->set('newAuthor', 'Jane Doe')
->set('newLicenseType', ImageLicenseType::Own->value)
->set('newPeopleRightsStatus', 'none')
->set('newPropertyRightsStatus', 'none')
->set('newRightsConfirmed', true)
->call('saveImage')
->assertHasErrors(['newCopyright']);
});
test('switching the license type clears the stale license detail', function () {
/** @var TestCase $this */
['owner' => $owner, 'pr' => $pr] = makeImageDraftOwner();
$this->actingAs($owner);
LivewireVolt::test('components.press-release-images-manager', ['pressReleaseId' => $pr->id])
->set('newLicenseType', ImageLicenseType::CreativeCommons->value)
->set('newLicenseDetail', 'cc_by')
->set('newLicenseType', ImageLicenseType::Other->value)
->assertSet('newLicenseDetail', '');
});
test('existing title image hides upload form and can be removed', function () {
/** @var TestCase $this */
['owner' => $owner, 'pr' => $pr] = makeImageDraftOwner();