Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293430

ToolkitGdTest uses checkRequirements() incorrectly

$
0
0

Problem/Motivation

Doing some follow-through on #2728579: Support @require module in phpunit kernel and browser tests I discovered that ToolkitGdTest has a checkRequirements() method, which overrides \PHPUnit_Framework_TestCase::checkRequirements().

This is probably left over from the Simpletest days. It was converted from Simpletest with all system module tests in #2687897: Convert system module's kernel tests to NG

The problem is that it tries to signal its requirements by returning a value, even though PHPUnit ignores the returned value and expects an exception if the requirement isn't met.

Here's what it looks like:

  protected function checkRequirements() {
    // GD2 support is available.
    if (!function_exists('imagegd2')) {
      return ['Image manipulations for the GD toolkit cannot run because the GD toolkit is not available.',
      ];
    }
    return parent::checkRequirements();
  }

Proposed resolution

  • Move the requirement for the imagegd2() function to a @requires annotation.
  • Remove the checkRequirements() method.

Remaining tasks

User interface changes

API changes

Data model changes


Viewing all articles
Browse latest Browse all 293430

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>