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
075d0d931f
commit
70e15d5df5
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);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue