Skip to content
Snippets Groups Projects

Resolve #3292350 "File validate image resolution 10.1.x"

Files
2
@@ -36,6 +36,7 @@ protected function setUp(): void {
/** @var \Drupal\Core\File\FileSystemInterface $file_system */
$file_system = \Drupal::service('file_system');
$this->image->setFilename($file_system->basename($this->image->getFileUri()));
$this->image->setSize(@filesize($this->image->getFileUri()));
$this->nonImage = File::create();
$this->nonImage->setFileUri('core/assets/vendor/jquery/jquery.min.js');
@@ -186,6 +187,8 @@ public function testFileValidateImageResolution() {
// Verify that the image was scaled to the correct width and height.
$this->assertLessThanOrEqual(10, $image->getWidth());
$this->assertLessThanOrEqual(5, $image->getHeight());
// Verify that the file size has been updated after resizing.
$this->assertEquals($this->image->getSize(), $image->getFileSize());
// Once again, now with negative width and height to force an error.
copy('core/misc/druplicon.png', 'temporary://druplicon.png');
Loading