Problem/Motivation

There are a number of deprecations notices being thrown by tests:

$ ../vendor/phpunit/phpunit/phpunit -c core/ modules/contrib/oembed_providers/ --verbose
PHPUnit 9.5.5 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.3.25-1+0~20201130.73+debian10~1.gbp042074
Configuration: /var/www/html/web/core/phpunit.xml.dist
Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using "--migrate-configuration"!

Testing /var/www/html/web/modules/contrib/oembed_providers
....................................................              52 / 52 (100%)

Time: 06:45.284, Memory: 8.00 MB

OK (52 tests, 211 assertions)

Remaining self deprecation notices (77)

  38x: Declaring ::setUp without a void return typehint in Drupal\Tests\oembed_providers\Unit\UrlIsValidTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    38x in DrupalListener::startTest from Drupal\Tests\Listeners

  18x: Calling Drupal\Tests\WebAssert::statusCodeEquals with more than one argument is deprecated in drupal:9.1.0 and will throw an \InvalidArgumentException in drupal:10.0.0. See https://www.drupal.org/node/3162537
    8x in CustomProvidersUiTest::testRoutePermissions from Drupal\Tests\oembed_providers\Functional
    8x in ProviderBucketTest::testRoutePermissions from Drupal\Tests\oembed_providers\Functional
    2x in SettingsFormTest::testRoutePermissions from Drupal\Tests\oembed_providers\Functional

  5x: The Drupal\Tests\oembed_providers\Functional\ProviderRepositoryTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    5x in DrupalListener::startTest from Drupal\Tests\Listeners

  2x: Declaring ::setUp without a void return typehint in Drupal\Tests\oembed_providers\Functional\ProviderBucketTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    2x in DrupalListener::startTest from Drupal\Tests\Listeners

  2x: The Drupal\Tests\oembed_providers\Functional\ProviderBucketTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    2x in DrupalListener::startTest from Drupal\Tests\Listeners

  2x: Declaring ::setUp without a void return typehint in Drupal\Tests\oembed_providers\Functional\SettingsFormTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    2x in DrupalListener::startTest from Drupal\Tests\Listeners

  2x: The Drupal\Tests\oembed_providers\Functional\SettingsFormTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    2x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\oembed_providers\Functional\CustomProviderRepositoryTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: The Drupal\Tests\oembed_providers\Functional\CustomProviderRepositoryTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\oembed_providers\Functional\CustomProvidersUiTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: The Drupal\Tests\oembed_providers\Functional\CustomProvidersUiTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\oembed_providers\Functional\ExternalFetchTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: The Drupal\Tests\oembed_providers\Functional\ExternalFetchTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: Declaring ::setUp without a void return typehint in Drupal\Tests\oembed_providers\FunctionalJavascript\CustomProvidersUiTest is deprecated in drupal:9.0.0. Typehinting will be required before drupal:10.0.0. See https://www.drupal.org/node/3114724
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

  1x: The Drupal\Tests\oembed_providers\FunctionalJavascript\CustomProvidersUiTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
    1x in DrupalListener::startTest from Drupal\Tests\Listeners

There are also some coding standards that need addressed:

$ phpcs --standard=Drupal,DrupalPractice *

FILE: .../oembed_providers/tests/src/FunctionalJavascript/CustomProvidersUiTest.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 13 | WARNING | The class short comment should describe what the class does and
    |         | not simply repeat the class name
--------------------------------------------------------------------------------


FILE: ...s/contrib/oembed_providers/tests/src/Functional/ProviderRepositoryTest.php
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
  64 | ERROR | Description for the @return value is missing
 107 | ERROR | Description for the @return value is missing
--------------------------------------------------------------------------------


FILE: ...es/contrib/oembed_providers/tests/src/Functional/CustomProvidersUiTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------
 11 | WARNING | [ ] The class short comment should describe what the class does
    |         |     and not simply repeat the class name
 92 | ERROR   | [x] There should be no white space before a closing ")"
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------


FILE: ...odules/contrib/oembed_providers/tests/src/Functional/ExternalFetchTest.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 12 | WARNING | The class short comment should describe what the class does and
    |         | not simply repeat the class name
--------------------------------------------------------------------------------


FILE: ...dules/contrib/oembed_providers/tests/src/Functional/ProviderBucketTest.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 12 | WARNING | The class short comment should describe what the class does and
    |         | not simply repeat the class name
--------------------------------------------------------------------------------


FILE: ...modules/contrib/oembed_providers/tests/src/Functional/SettingsFormTest.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
--------------------------------------------------------------------------------
 12 | WARNING | The class short comment should describe what the class does and
    |         | not simply repeat the class name
--------------------------------------------------------------------------------


FILE: ...iders/web/modules/contrib/oembed_providers/tests/src/Kernel/UpdateTest.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
--------------------------------------------------------------------------------
  7 | WARNING | [x] Unused use statement
 21 | ERROR   | [ ] Do not disable strict config schema checking in tests.
    |         |     Instead ensure your module properly declares its schema for
    |         |     configurations.
--------------------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
--------------------------------------------------------------------------------

Time: 536ms; Memory: 12MB

This issue is targeted at 2.x since 1.x will only receive bug fixes from this point going forward.

Proposed resolution

Address issues

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
new13.03 KB

Patch attached.

chris burge’s picture

Status: Needs review » Fixed

Everything has been taken care of except for the following:

 21 | ERROR   | [ ] Do not disable strict config schema checking in tests.
    |         |     Instead ensure your module properly declares its schema for
    |         |     configurations.

We need to disable scheme checking so we can install the "old" schema and then test the update function. Without disabling schema checking, the test will fail on D.O.

  • Chris Burge authored 1d09319 on 2.x
    Issue #3221752 by Chris Burge: Address Deprecated Code in Tests; Coding...

Status: Fixed » Closed (fixed)

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