You are here

protected function EditorUploadImageScaleTest::assertSavedMaxDimensions in Drupal 8

Same name and namespace in other branches
  1. 9 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.

Return value

bool

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($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'],
  ];
  $same_width = $this
    ->assertEqual($width, $expected['width'], 'Actual width of "' . $width . '" equals the expected width of "' . $expected['width'] . '"');
  $same_height = $this
    ->assertEqual($height, $expected['height'], 'Actual height of "' . $height . '" equals the expected width of "' . $expected['height'] . '"');
  return $same_width && $same_height;
}