Allow heading tags (h1-h6) in ContentSanitizer so news editor headings render
This commit is contained in:
38
tests/Unit/Enhance/EnhanceValidatorTest.php
Normal file
38
tests/Unit/Enhance/EnhanceValidatorTest.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Services\Enhance\EnhanceValidator;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Tests\TestCase;
|
||||
|
||||
uses(TestCase::class, RefreshDatabase::class);
|
||||
|
||||
it('validates a supported uploaded image and normalizes options', function (): void {
|
||||
$file = UploadedFile::fake()->image('artwork.png', 1400, 900)->size(768);
|
||||
|
||||
$validated = app(EnhanceValidator::class)->validateUpload($file, [
|
||||
'scale' => 4,
|
||||
'mode' => 'illustration',
|
||||
'engine' => 'stub',
|
||||
]);
|
||||
|
||||
expect($validated['scale'])->toBe(4);
|
||||
expect($validated['mode'])->toBe('illustration');
|
||||
expect($validated['engine'])->toBe('stub');
|
||||
expect($validated['input_width'])->toBe(1400);
|
||||
expect($validated['input_height'])->toBe(900);
|
||||
expect($validated['input_mime'])->toBe('image/png');
|
||||
});
|
||||
|
||||
it('rejects unsupported image formats', function (): void {
|
||||
$file = UploadedFile::fake()->create('vector.svg', 10, 'image/svg+xml');
|
||||
|
||||
app(EnhanceValidator::class)->validateUpload($file, [
|
||||
'scale' => 2,
|
||||
'mode' => 'standard',
|
||||
'engine' => 'stub',
|
||||
]);
|
||||
})->throws(ValidationException::class);
|
||||
Reference in New Issue
Block a user