From 3a2868af2b22a762e5d74dcebadcec55e87dda60 Mon Sep 17 00:00:00 2001 From: Freek Van der Herten Date: Fri, 8 Dec 2023 14:59:39 +0100 Subject: [PATCH] fix tests --- .../Conversions/ConversionCollectionTest.php | 21 +++++++++---------- .../MediaConversions/AddMediaTest.php | 6 +++--- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/tests/Conversions/ConversionCollectionTest.php b/tests/Conversions/ConversionCollectionTest.php index cf7aa7171..80e6450d6 100644 --- a/tests/Conversions/ConversionCollectionTest.php +++ b/tests/Conversions/ConversionCollectionTest.php @@ -55,25 +55,24 @@ it('will prepend the manipulation saved on the model', function () { $conversionCollection = ConversionCollection::createForMedia($this->media); - $conversion = $conversionCollection->getConversions()[0]; + $conversion = $conversionCollection->getConversions()->first(); expect($conversion->getName())->toEqual('thumb'); - $manipulationSequence = $conversion + $manipulations = $conversion ->getManipulations() - ->getManipulationSequence() ->toArray(); - $this->assertArrayHasKey('optimize', $manipulationSequence[0]); + $this->assertArrayHasKey('optimize', $manipulations); - unset($manipulationSequence[0]['optimize']); + unset($manipulations['optimize']); - $this->assertEquals([[ - 'filter' => 'greyscale', - 'height' => 10, - 'width' => 50, - 'format' => 'jpg', - ]], $manipulationSequence); + $this->assertEquals([ + 'greyscale' => [], + 'height' => [10], + 'format' => ['jpg'], + 'width' => [50], + ], $manipulations); }); it('will apply the manipulation on the equally named conversion of every model', function () { diff --git a/tests/Feature/FileAdder/MediaConversions/AddMediaTest.php b/tests/Feature/FileAdder/MediaConversions/AddMediaTest.php index 595f342a6..49f5c2930 100644 --- a/tests/Feature/FileAdder/MediaConversions/AddMediaTest.php +++ b/tests/Feature/FileAdder/MediaConversions/AddMediaTest.php @@ -122,14 +122,14 @@ public function registerMediaConversions(Media $media = null): void $conversionCollection = ConversionCollection::createForMedia($media); - $conversion = $conversionCollection->getConversions()[0]; + $conversion = $conversionCollection->getConversions()->first(); $conversionManipulations = $conversion ->getManipulations() ->getManipulationSequence() - ->toArray()[0]; + ->toArray(); - expect($conversionManipulations['width'])->toEqual(123); + expect($conversionManipulations['width'])->toEqual([123]); }); it('can set filesize', function () {