assertSavedMaxDimensions example


  public function testEditorUploadImageScale() {
    // Generate testing images.     $testing_image_list = $this->getTestFiles('image');

    // Case 1: no max dimensions set: uploaded image not scaled.     $test_image = $testing_image_list[0];
    [$image_file_width$image_file_height] = $this->getTestImageInfo($test_image->uri);
    $max_width = NULL;
    $max_height = NULL;
    $this->setMaxDimensions($max_width$max_height);
    $this->assertSavedMaxDimensions($max_width$max_height);
    [$uploaded_image_file_width$uploaded_image_file_height] = $this->uploadImage($test_image->uri);
    $this->assertEquals($image_file_width$uploaded_image_file_width);
    $this->assertEquals($image_file_height$uploaded_image_file_height);
    $this->assertSession()->pageTextNotContains("The image was resized to fit within the maximum allowed dimensions of {$max_width}x{$max_height} pixels.");

    // Case 2: max width smaller than uploaded image: image scaled down.     $test_image = $testing_image_list[1];
    [$image_file_width$image_file_height] = $this->getTestImageInfo($test_image->uri);
    $max_width = $image_file_width - 5;
    $max_height = $image_file_height;
    $this->setMaxDimensions($max_width$max_height);
    
Home | Imprint | This part of the site doesn't use cookies.