Skip to content

Commit

Permalink
Add Test for FileAdder with Manipulations using Enum Parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
tkempf committed Apr 16, 2024
1 parent ec8f1a8 commit 97b92d9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/Feature/FileAdder/IntegrationTest.php
Expand Up @@ -16,6 +16,7 @@
use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Spatie\MediaLibrary\Tests\TestSupport\RenameOriginalFileNamer;
use Spatie\MediaLibrary\Tests\TestSupport\TestModels\TestModel;
use Spatie\Image\Enums\BorderType;
use Symfony\Component\HttpFoundation\File\UploadedFile;

it('can add an file to the default collection', function () {
Expand Down Expand Up @@ -451,6 +452,18 @@
expect($media->manipulations['thumb']['width'])->toEqual(['10']);
});

it('can add manipulations with parameters of type Enum to the saved media', function () {
$media = $this->testModelWithConversion
->addMedia($this->getTestJpg())
->preservingOriginal()
->withManipulations(['thumb' => [
'background' => ['color'=>'ffffff'],
'border' =>['width'=>15, 'type'=>BorderType::Shrink, 'color'=>'000000']
]
])
->toMediaCollection();
})->throwsNoExceptions();

it('can add file to model with morph map', function () {
$media = $this->testModelWithMorphMap
->addMedia($this->getTestJpg())
Expand Down

0 comments on commit 97b92d9

Please sign in to comment.