Commit c42c4e6d authored by Adam G-H's avatar Adam G-H
Browse files

Issue #3293603 by LOBsTerr, phenaproxima: parse_url(): Passing null to...

Issue #3293603 by LOBsTerr, phenaproxima: parse_url(): Passing null to parameter #1 ($url) of type string is deprecated in image_widget_crop_requirements()
parent 6c61f941
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ function image_widget_crop_requirements($phase) {
    ];

    foreach ($files as $type => $file) {
      $is_local = parse_url($file, PHP_URL_SCHEME) === NULL && strpos($file, '//') !== 0;
      $is_local = !empty($file) && parse_url($file, PHP_URL_SCHEME) === NULL && strpos($file, '//') !== 0;
      // If libraries module is active check if folder is malformed.
      if ($is_local
        && \Drupal::moduleHandler()->moduleExists('libraries')
+35 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\Tests\image_widget_crop\Kernel;

use Drupal\KernelTests\KernelTestBase;

/**
 * Minimal test case for the image_widget_crop module.
 *
 * @group image_widget_crop
 *
 * @ingroup media
 */
class ImageWidgetCropTest extends KernelTestBase {

  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'file',
    'image',
    'crop',
    'image_widget_crop',
  ];

  /**
   * Tests that image_widget_crop_requirements() returns an array.
   */
  public function testRequirements() {
    $this->container->get('module_handler')->loadInclude('image_widget_crop', 'install');
    $requirements = image_widget_crop_requirements('runtime');
    $this->assertIsArray($requirements);
  }

}