You are here

protected function EditorUploadImageScaleTest::assertSavedMaxDimensions in Drupal 9

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

Asserts whether the saved maximum dimensions equal the ones provided.

Parameters

string $width: The expected width of the uploaded image.

string $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 222

Class

EditorUploadImageScaleTest
Tests scaling of inline images.

Namespace

Drupal\Tests\editor\Functional

Code

protected function assertSavedMaxDimensions($width, $height) {
  $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'] . '"');
}