Kaynağa Gözat

Merge branch 'hotfix/fix_unit_tests'

Olivier Massot 6 ay önce
ebeveyn
işleme
f76b1781d4

+ 1 - 3
src/Service/OnChange/Core/OnFileChange.php

@@ -15,12 +15,10 @@ use Liip\ImagineBundle\Imagine\Cache\CacheManager;
 class OnFileChange extends OnChangeDefault
 {
     public function __construct(
-        protected readonly CacheManager $cacheManager
+        protected readonly CacheManager $cacheManager,
     ) {
-
     }
 
-
     public function beforeChange(mixed $file, OnChangeContext $context): void
     {
         if ($context->previousData() && $context->previousData()->getConfig() !== $file->getConfig()) {

+ 2 - 2
src/State/Provider/Core/ImageProvider.php

@@ -40,8 +40,8 @@ final class ImageProvider implements ProviderInterface
         }
 
         $uncropped =
-            isset($context['filters']['uncropped']) &&
-            ($context['filters']['uncropped'] === '1' || $context['filters']['uncropped'] === 'true');
+            isset($context['filters']['uncropped'])
+            && ($context['filters']['uncropped'] === '1' || $context['filters']['uncropped'] === 'true');
 
         return $this->getImage($uriVariables['fileId'], $uriVariables['size'], $uncropped);
     }

+ 10 - 10
tests/Unit/Service/File/Storage/LocalStorageTest.php

@@ -40,9 +40,9 @@ class TestableLocalStorage extends LocalStorage
         return parent::getOrganizationAndPersonFromOwner($owner);
     }
 
-    public function getFilterFromSizeAndConfig(string $size, bool $configExist): string
+    public function getFilterFromSizeAndConfig(string $size, bool $crop = true): string
     {
-        return parent::getFilterFromSizeAndConfig($size, $configExist);
+        return parent::getFilterFromSizeAndConfig($size, $crop);
     }
 
     public function rrmDir(string $dirKey): void
@@ -188,7 +188,7 @@ class LocalStorageTest extends TestCase
 
         $this->assertEquals(
             'publicUrl/xyz',
-            $localStorage->getImageUrl($file, 'sm', false)
+            $localStorage->getImageUrl($file, 'sm', false, false)
         );
     }
 
@@ -222,7 +222,7 @@ class LocalStorageTest extends TestCase
 
         $this->assertEquals(
             'xyz',
-            $localStorage->getImageUrl($file, 'sm', true)
+            $localStorage->getImageUrl($file, 'sm', true, false)
         );
     }
 
@@ -247,7 +247,7 @@ class LocalStorageTest extends TestCase
         $this->imageFactory
             ->expects(self::once())
             ->method('createImageContent')
-            ->with($file, 'crop_sm');
+            ->with($file, 'crop_sm', false);
 
         $this->cacheManager
             ->method('resolve')
@@ -256,7 +256,7 @@ class LocalStorageTest extends TestCase
 
         $this->assertEquals(
             'publicUrl/xyz',
-            $localStorage->getImageUrl($file, 'sm', false)
+            $localStorage->getImageUrl($file, 'sm', false, false)
         );
     }
 
@@ -281,7 +281,7 @@ class LocalStorageTest extends TestCase
         $this->imageFactory
             ->expects(self::once())
             ->method('createImageContent')
-            ->with($file, 'crop_sm')
+            ->with($file, 'crop_sm', false)
             ->willThrowException(new \Exception('File not found'));
 
         $this->cacheManager
@@ -295,7 +295,7 @@ class LocalStorageTest extends TestCase
 
         $this->assertEquals(
             'publicUrl/images/missing-file.png',
-            $localStorage->getImageUrl($file, 'sm', false)
+            $localStorage->getImageUrl($file, 'sm', false, false)
         );
     }
 
@@ -320,7 +320,7 @@ class LocalStorageTest extends TestCase
         $this->imageFactory
             ->expects(self::once())
             ->method('createImageContent')
-            ->with($file, 'crop_sm')
+            ->with($file, 'crop_sm', false)
             ->willThrowException(new \Exception('File not found'));
 
         $this->cacheManager
@@ -329,7 +329,7 @@ class LocalStorageTest extends TestCase
 
         $this->assertEquals(
             'images/missing-file.png',
-            $localStorage->getImageUrl($file, 'sm', true)
+            $localStorage->getImageUrl($file, 'sm', true, false)
         );
     }