images: press-release-images:regenerate-variants --only=og für den Bestand, Testhelfer eindeutig benannt (Bildkennzeichnung H.1)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
62723b551a
commit
3b613fadf4
3 changed files with 135 additions and 5 deletions
|
|
@ -137,3 +137,32 @@ test('teasers carry the credit in alt and title and the hero shows a caption', f
|
|||
->assertSee('alt="Teaser-Meldung · Foto: Anna Beispiel · KI-generiert"', false)
|
||||
->assertSee('data-image-credit-teaser', false);
|
||||
});
|
||||
|
||||
test('the regenerate command builds missing og variants for the existing stock with the credit line', function () {
|
||||
/** @var TestCase $this */
|
||||
$company = Company::factory()->presseecho()->create(['name' => 'Bestand GmbH', 'is_active' => true]);
|
||||
$pr = PressRelease::factory()->published()->for($company)->create(['published_ever_at' => now()->subDay()]);
|
||||
|
||||
$upload = UploadedFile::fake()->image('alt.jpg', 1600, 900)->size(100);
|
||||
$stored = (new ImageService)->storePressReleaseImage($upload, $pr->id, 'local');
|
||||
$variants = $stored['variants'];
|
||||
Storage::disk('local')->delete($variants['og']);
|
||||
unset($variants['og']);
|
||||
|
||||
$image = PressReleaseImage::factory()->for($pr)->legacy()->create(['disk' => 'local', 'path' => $stored['path'], 'variants' => $variants]);
|
||||
|
||||
$this->artisan('press-release-images:regenerate-variants', ['--only' => 'og', '--published' => true])
|
||||
->expectsOutputToContain('Trockenlauf: OG-Varianten für 1 von 1 Bildern.')
|
||||
->assertSuccessful();
|
||||
|
||||
expect($image->fresh()->variants)->not->toHaveKey('og');
|
||||
|
||||
$this->artisan('press-release-images:regenerate-variants', ['--only' => 'og', '--published' => true, '--execute' => true])
|
||||
->expectsOutputToContain('OG-Varianten erzeugt: 1')
|
||||
->assertSuccessful();
|
||||
|
||||
$og = $image->fresh()->variants['og'] ?? null;
|
||||
expect($og)->not->toBeNull()
|
||||
->and(Storage::disk('local')->exists($og))->toBeTrue()
|
||||
->and(getimagesize(Storage::disk('local')->path($og))[0])->toBe(1200);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ beforeEach(function (): void {
|
|||
/**
|
||||
* @return array{owner: User, pr: PressRelease}
|
||||
*/
|
||||
function gateDraft(): array
|
||||
function legalGateDraft(): array
|
||||
{
|
||||
$owner = User::factory()->create(['is_active' => true]);
|
||||
$owner->assignRole('customer');
|
||||
|
|
@ -49,7 +49,7 @@ function gateDraft(): array
|
|||
|
||||
test('with the gate off nothing is required and submitting works as before', function () {
|
||||
/** @var TestCase $this */
|
||||
['owner' => $owner, 'pr' => $pr] = gateDraft();
|
||||
['owner' => $owner, 'pr' => $pr] = legalGateDraft();
|
||||
$this->actingAs($owner);
|
||||
|
||||
expect(app(LegalAcceptanceGate::class)->requiredFor($owner))->toBeEmpty();
|
||||
|
|
@ -68,7 +68,7 @@ test('with the gate off nothing is required and submitting works as before', fun
|
|||
test('with the gate on the submit requires an active acceptance of agb and guidelines and records both', function () {
|
||||
/** @var TestCase $this */
|
||||
config()->set('legal.acceptance_gate', true);
|
||||
['owner' => $owner, 'pr' => $pr] = gateDraft();
|
||||
['owner' => $owner, 'pr' => $pr] = legalGateDraft();
|
||||
$this->actingAs($owner);
|
||||
|
||||
expect(app(LegalAcceptanceGate::class)->requiredFor($owner)->pluck('type')->all())->toBe(['agb', 'richtlinien']);
|
||||
|
|
@ -99,7 +99,7 @@ test('with the gate on the submit requires an active acceptance of agb and guide
|
|||
|
||||
test('acceptances are insert-only', function () {
|
||||
config()->set('legal.acceptance_gate', true);
|
||||
['owner' => $owner] = gateDraft();
|
||||
['owner' => $owner] = legalGateDraft();
|
||||
$gate = app(LegalAcceptanceGate::class);
|
||||
$rows = $gate->accept($owner, $gate->requiredFor($owner), 'gate', '203.0.113.5', 'Pest');
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ test('acceptances are insert-only', function () {
|
|||
test('the api answers 428 with the required documents until they are accepted', function () {
|
||||
/** @var TestCase $this */
|
||||
config()->set('legal.acceptance_gate', true);
|
||||
['owner' => $owner, 'pr' => $pr] = gateDraft();
|
||||
['owner' => $owner, 'pr' => $pr] = legalGateDraft();
|
||||
Sanctum::actingAs($owner, ['press-releases:write', 'press-releases:read']);
|
||||
|
||||
$this->postJson("/api/v1/press-releases/{$pr->id}/submit", ['ai_text_declaration' => 'none'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue