Slick PHPUnit error report,

PHPunit Test failed to complete; Error: PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

Testing Drupal\Tests\slick\Kernel\SlickFormatterTest ....... 7 / 7 (100%)

Time: 1.25 minutes, Memory: 6.00MB

OK (7 tests, 66 assertions)
Remaining deprecation notices (7) 7x: Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was blazy_test_pre_render. Support for this callback implementation is deprecated in 8.8.0 and will be removed in Drupal 9.0.0. See https://www.drupal.org/node/2966725 7x in SlickFormatterTest::testSlickFormatter from Drupal\Tests\slick\Kernel

Comments

nashkrammer created an issue. See original summary.

nashkrammer’s picture

Status: Active » Needs review
StatusFileSize
new3.31 KB

Fixed deprecated #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface.

gausarts’s picture

Status: Needs review » Postponed (maintainer needs more info)

Thank you!

But perhaps it is too early. The required class is not there yet. When Drupal stable version reaches 8.9, and Blazy explicitly depends on D8.8, this can work.

Also you may want to remove the deprecated function blazy_test_pre_render altogether rather than keeping it.

Feel free to postpone it for future task. Also please update the related issue at Slick.

Thoughts?

gausarts’s picture

Status: Postponed (maintainer needs more info) » Postponed

Let's postpone this till June 3, 2020 or few months after 8.9 out. Otherwise this patch may kill 6K+ websites using D8.7 below (the current majority sites using Blazy 2.x as of this writing). Feel free to-reopen it once you think it is safe to apply it. Thanks!

gausarts’s picture

Just a friendly reminder to myself:
Be sure to also update GridStack with the relevant patch accordingly before committing this!

nashkrammer’s picture

@gausarts, thanks updating the status, The test would pass with Drupal core 8.8, so it best to postpone this. I see that you already updated the related issue on Slick module.

gausarts’s picture

Issue tags: +blazy d9

Added special for easy tracking related issues.

kristen pol’s picture

Issue tags: -blazy d9 +Drupal 9 compatibility

Per a Slack discussion with Gábor Hojtsy regarding usage of D9 tags (Drupal 9, Drupal 9 compatibility, Drupal 9 readiness, etc.), "Drupal 9 compatibility" should be used for contributed projects that need updating and "Drupal 9" was the old tag for D8 issues before the D9 branch was ready. Doing tag cleanup here based on that discussion.

gausarts’s picture

Status: Postponed » Active

The latest RC7 has no longer worked for D8.7 by mistakes starting with this feature #3113089: Fix subclassing and stop overriding constructors in blazy\Plugin\Field\FieldFormatter\BlazyMediaFormatterBase.
The reason, Drupal 8 FormatterBase never implements ContainerFactoryPluginInterface till D8.8, and I missed reviewing it against D8.7.

While we can add a BC for D8.7 post RC7, however seeing this particular issue is far more crucial than BC, I thought we should move forward. D8.7 Blazy users can stick to RC6 till they have time to upgrade to D8.8.

Let's re-open this sooner than June 3, 2020 thanks to my oversight mistake. Doh.

berdir’s picture

Status: Active » Needs work
+++ b/tests/modules/blazy_test/blazy_test.module
@@ -61,14 +62,8 @@ function blazy_test_blazy_alter(array &$image, array $settings = []) {
  */
 function blazy_test_pre_render($image) {
-  $settings = isset($image['#settings']) ? $image['#settings'] : [];
-
-  // Video's HREF points to external site, adds URL to local image.
-  if (!empty($settings['box_url']) && !empty($settings['embed_url'])) {
-    $image['#url_attributes']['data-box-url'] = $settings['box_url'];
-  }
-
-  return $image;
+  @trigger_error('blazy_test_pre_render() is deprecated in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Use \Drupal\blazy\BlazyTestAlter::preRender() instead. See https://www.drupal.org/node/2966725', E_USER_DEPRECATED);
+  return BlazyTestAlter::preRender($image);
 }

The message doesn't really make sense as this is obviously not a core deprecation.

Probably makes sense if the maintainer defines if he wants to keep this for BC or just remove it. IMHO it would be fine to remove.

Also, the patch should raise the required version to "^8.8 || ^9" then, remove the core key and also the "(>= 8.6)" part from the drupal:media dependency.

gausarts’s picture

We should be remove it and incorporate the rest of suggestions. Thank you.

gausarts’s picture

Title: Fix deprecation error in Slick PHPUnit test "Drupal\Tests\slick\Kernel\SlickFormatterTest" » Implement TrustedCallbackInterface to fix deprecation notices
Status: Needs work » Needs review
StatusFileSize
new6.1 KB

Attached to move forward with D8.8+.
Let's see if any issue I am not aware of.

  • gausarts committed 370803c on 8.x-2.x authored by nashkrammer
    Issue #3079167 by gausarts, nashkrammer, Kristen Pol, Berdir: Implement...
gausarts’s picture

Status: Needs review » Fixed

Thou shall not kill kittens, even by mistake. Thou shall move forward, though. Move on!

Any (side) issue and improvements may follow as always.
Committed with minor change. Thank you for contribution!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.