function EditorUploadImageScaleTest::assertSavedMaxDimensions

Same name and namespace in other branches
  1. 8.9.x core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php \Drupal\Tests\editor\Functional\EditorUploadImageScaleTest::assertSavedMaxDimensions()
  2. 10 core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php \Drupal\Tests\editor\Functional\EditorUploadImageScaleTest::assertSavedMaxDimensions()

Asserts whether the saved maximum dimensions equal the ones provided.

@internal

Parameters

int|null $width: The expected width of the uploaded image.

int|null $height: The expected height of the uploaded image.

1 call to EditorUploadImageScaleTest::assertSavedMaxDimensions()
EditorUploadImageScaleTest::testEditorUploadImageScale in core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php
Tests scaling of inline images.

File

core/modules/editor/tests/src/Functional/EditorUploadImageScaleTest.php, line 224

Class

EditorUploadImageScaleTest
Tests scaling of inline images.

Namespace

Drupal\Tests\editor\Functional

Code

protected function assertSavedMaxDimensions(?int $width, ?int $height) : void {
    $image_upload_settings = Editor::load('basic_html')->getImageUploadSettings();
    $expected = [
        'width' => $image_upload_settings['max_dimensions']['width'],
        'height' => $image_upload_settings['max_dimensions']['height'],
    ];
    $this->assertEquals($expected['width'], $width, 'Actual width of "' . $width . '" equals the expected width of "' . $expected['width'] . '"');
    $this->assertEquals($expected['height'], $height, 'Actual height of "' . $height . '" equals the expected width of "' . $expected['height'] . '"');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.