Closed (fixed)
Project:
Scheduler
Version:
2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
22 Jul 2024 at 15:32 UTC
Updated:
13 Aug 2024 at 12:37 UTC
Jump to comment: Most recent
We need to ensure all PHPUnit tests are compatible with PHPUnit 10 by updating all dataProvider methods to be static. This is a mandatory requirement for running tests in Drupal 11, as non-static dataProvider methods will cause PHPUnit deprecation warnings and potential test failures.
Change Record: Changes required for PHPUnit 10 compatibility
Issue: #3353210: [PHPUnit 10] @dataProvider methods must be declared static and public
Run the PHPUnit tests on Drupal 11 and you would see test failure with showing deprecation warnings.
dataProvider methods within tests directory. A dataProvider method is usually annotated with @dataProvider in the test methods.dataProvider
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
vishalkhode commentedComment #4
vishalkhode commentedCherry-picked @chandu7929 commit from #3434325: Drupal 11 compatibility fixes [2.x].
Comment #5
vishalkhode commentedComment #6
deepakkm commentedVerified this and its working fine
Comment #7
vishalkhode commentedHi @jonathan1055
Can you review/merge the changes as I've rebased now with #3463494: Gitlab PHPunit jobs at D11 need compatible test dependencies.
Thanks.
Comment #8
jonathan1055 commentedIn due course, yes. You do't need to prompt me :)
I am working on #3458430: Call to undefined method getName when running PHPUnit tests on Drupal 11 and #3463136: Remove default_argument_skip_url key from view configurations
The other main problem is #3451750: Fix: The update to convert "numeric" arguments to "entity_target_id" is deprecated
Comment #9
jonathan1055 commentedPrevious tests had
All of these errors have been removed with the MR
Accesing
$thisin data providers is no longer allowed, so these have been replaced withself::dataStandardEntityTypes(). The only place where hardcoded entity types have been used is in the definition of the two functions. There is no simple way round this, so we accept that this is duplicated hard-coding.Thanks. Merged and fixed
Comment #11
jonathan1055 commentedSomething odd happened. The status and related issue changes in #9 got lost, so re-doing.
Comment #12
jonathan1055 commentedThe credit I gave in #9 also got lost, so re-doing that too.
Comment #15
jonathan1055 commentedI also did the equivalent for 8.x-1.x
https://git.drupalcode.org/project/scheduler/-/commit/b7674877fb2289b082...