Teren-app/tests/Unit/RepairImgWithoutSrcTest.php
Simon Pocrnjič 1b615163be email support
2025-10-11 17:20:05 +02:00

25 lines
709 B
PHP

<?php
use App\Http\Controllers\Admin\EmailTemplateController;
it('adds src to img when a /storage URL appears shortly after the tag', function () {
$controller = new EmailTemplateController;
$input = <<<HTML
<div>
<img alt="Logo" width="300" style="display:block;margin:0 auto 16px">
\n\n
https://localhost/storage/email-images/logo.png
</div>
HTML;
$ref = new ReflectionClass($controller);
$method = $ref->getMethod('repairImgWithoutSrc');
$method->setAccessible(true);
/** @var string $output */
$output = $method->invoke($controller, $input);
expect($output)->toContain('src="https://localhost/storage/email-images/logo.png"');
});