@@ -217,8 +217,8 @@ public function testClassBasedCustomReplacers()
217217
218218 public function testNestedAttributesAreReplacedInDimensions ()
219219 {
220- // Knowing that demo image.gif has width = 3 and height = 2
221- $ uploadedFile = new \Symfony \Component \HttpFoundation \File \UploadedFile (__DIR__ .'/fixtures/image.gif ' , '' , null , null , null , true );
220+ // Knowing that demo image.png has width = 3 and height = 2
221+ $ uploadedFile = new \Symfony \Component \HttpFoundation \File \UploadedFile (__DIR__ .'/fixtures/image.png ' , '' , null , null , null , true );
222222
223223 $ trans = $ this ->getIlluminateArrayTranslator ();
224224 $ trans ->addLines (['validation.dimensions ' => ':min_width :max_height :ratio ' ], 'en ' );
@@ -1895,8 +1895,8 @@ public function testValidateImage()
18951895
18961896 public function testValidateImageDimensions ()
18971897 {
1898- // Knowing that demo image.gif has width = 3 and height = 2
1899- $ uploadedFile = new \Symfony \Component \HttpFoundation \File \UploadedFile (__DIR__ .'/fixtures/image.gif ' , '' , null , null , null , true );
1898+ // Knowing that demo image.png has width = 3 and height = 2
1899+ $ uploadedFile = new \Symfony \Component \HttpFoundation \File \UploadedFile (__DIR__ .'/fixtures/image.png ' , '' , null , null , null , true );
19001900 $ trans = $ this ->getIlluminateArrayTranslator ();
19011901
19021902 $ v = new Validator ($ trans , ['x ' => 'file ' ], ['x ' => 'dimensions ' ]);
@@ -1944,8 +1944,16 @@ public function testValidateImageDimensions()
19441944 $ v = new Validator ($ trans , ['x ' => $ uploadedFile ], ['x ' => 'dimensions:ratio=1 ' ]);
19451945 $ this ->assertTrue ($ v ->fails ());
19461946
1947+ // Knowing that demo image2.png has width = 4 and height = 2
1948+ $ uploadedFile = new \Symfony \Component \HttpFoundation \File \UploadedFile (__DIR__ .'/fixtures/image2.png ' , '' , null , null , null , true );
1949+ $ trans = $ this ->getIlluminateArrayTranslator ();
1950+
1951+ // Ensure validation doesn't erroneously fail when ratio has no fractional part
1952+ $ v = new Validator ($ trans , ['x ' => $ uploadedFile ], ['x ' => 'dimensions:ratio=2/1 ' ]);
1953+ $ this ->assertTrue ($ v ->passes ());
1954+
19471955 // This test fails without suppressing warnings on getimagesize() due to a read error.
1948- $ emptyUploadedFile = new \Symfony \Component \HttpFoundation \File \UploadedFile (__DIR__ .'/fixtures/empty.gif ' , '' , null , null , null , true );
1956+ $ emptyUploadedFile = new \Symfony \Component \HttpFoundation \File \UploadedFile (__DIR__ .'/fixtures/empty.png ' , '' , null , null , null , true );
19491957 $ trans = $ this ->getIlluminateArrayTranslator ();
19501958
19511959 $ v = new Validator ($ trans , ['x ' => $ emptyUploadedFile ], ['x ' => 'dimensions:min_width=1 ' ]);
0 commit comments