Problem/Motivation

Deprecation notices when running test suite with PHP 8.1:

Drupal\Tests\oembed_providers\Functional\ProviderBucketTest

exception: [Other] Line 0 of sites/default/files/simpletest/phpunit-3.xml:
PHPUnit Test failed to complete; Error: PHPUnit 9.5.20 �[44m#StandWith�[0m�[43mUkraine�[0m

Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using "--migrate-configuration"!

Testing Drupal\Tests\oembed_providers\Functional\ProviderBucketTest
EE.                                                                 3 / 3 (100%)

Time: 00:14.921, Memory: 6.00 MB

There were 2 errors:

1) Drupal\Tests\oembed_providers\Functional\ProviderBucketTest::testRoutePermissions
Exception: Deprecated function: Calling static trait method Drupal\oembed_providers\Traits\HelperTrait::disabledProviderSecurityWarning is deprecated, it should only be called on a class using the trait
Drupal\oembed_providers\OembedProviderBucketForm->form()() (Line: 86)


/var/www/html/core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php:49
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:204
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:153
/var/www/html/vendor/guzzlehttp/promises/src/TaskQueue.php:48
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:248
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:224
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:269
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:226
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:62
/var/www/html/vendor/guzzlehttp/guzzle/src/Client.php:182
/var/www/html/core/tests/Drupal/Tests/DrupalTestBrowser.php:137
/var/www/html/vendor/symfony/browser-kit/Client.php:404
/var/www/html/vendor/friends-of-behat/mink-browserkit-driver/src/BrowserKitDriver.php:145
/var/www/html/vendor/behat/mink/src/Session.php:148
/var/www/html/core/tests/Drupal/Tests/UiHelperTrait.php:334
/var/www/html/modules/contrib/oembed_providers/tests/src/Functional/ProviderBucketTest.php:92
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:726

2) Drupal\Tests\oembed_providers\Functional\ProviderBucketTest::testProviderBucketForm
Exception: Deprecated function: Calling static trait method Drupal\oembed_providers\Traits\HelperTrait::disabledProviderSecurityWarning is deprecated, it should only be called on a class using the trait
Drupal\oembed_providers\OembedProviderBucketForm->form()() (Line: 86)


/var/www/html/core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php:49
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:204
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:153
/var/www/html/vendor/guzzlehttp/promises/src/TaskQueue.php:48
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:248
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:224
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:269
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:226
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:62
/var/www/html/vendor/guzzlehttp/guzzle/src/Client.php:182
/var/www/html/core/tests/Drupal/Tests/DrupalTestBrowser.php:137
/var/www/html/vendor/symfony/browser-kit/Client.php:404
/var/www/html/vendor/friends-of-behat/mink-browserkit-driver/src/BrowserKitDriver.php:145
/var/www/html/vendor/behat/mink/src/Session.php:148
/var/www/html/core/tests/Drupal/Tests/UiHelperTrait.php:334
/var/www/html/modules/contrib/oembed_providers/tests/src/Functional/ProviderBucketTest.php:114
/var/www/html/vendor/phpunit/phpunit/src/Framework/TestResult.php:726

ERRORS!
Tests: 3, Assertions: 34, Errors: 2.

Steps to reproduce

Run test suite with PHP 8.1.

Proposed resolution

Change the class to use the trait and call the trait method with the class (instead of statically).

Remaining tasks

Submit patch.

User interface changes

None

API changes

None.

Data model changes

None.

Comments

Chris Burge created an issue. See original summary.

chris burge’s picture

Status: Active » Needs review
StatusFileSize
new856 bytes

Patch attached.

  • Chris Burge committed 87c365b on 2.x
    Issue #3278090 by Chris Burge: Calling static trait method is...
chris burge’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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

erwangel’s picture

I'm still getting this error when editing remote video type (admin/structure/media/manage/remote_video)

Deprecated function: Calling static trait method Drupal\oembed_providers\Traits\HelperTrait::disabledProviderSecurityWarning is deprecated, it should only be called on a class using the trait in oembed_providers_form_media_type_edit_form_alter() (line 61 of /path_to_site/modules/contrib/oembed_providers/oembed_providers.module).

Using: oEmbed Providers 2.2.0, Drupal core 10.3.6 , php 8.3.12

chris burge’s picture

@erwangel - This was fixed in #3473687: Calling static trait method is deprecated (redux) but hasn't been released yet.

erwangel’s picture

Thank you. I've seen you released a new version so I updated and everything looks good nnow.