Closed (fixed)
Project:
Scheduler
Version:
2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
2 Jul 2024 at 05:30 UTC
Updated:
8 Aug 2024 at 10:54 UTC
Jump to comment: Most recent
When running PHPUnit tests on Drupal 11 for the scheduler module, it throws below error:
Error: Call to undefined method Drupal\Tests\scheduler\Functional\SchedulerPermissionsTest::getName()
/Users/user1/drupal11.0.0-beta1/docroot/modules/contrib/scheduler/tests/src/Functional/SchedulerBrowserTestBase.php:59
/Users/user1/drupal11.0.0-beta1/docroot/modules/contrib/scheduler/tests/src/Functional/SchedulerPermissionsTest.php:48
The reason it thorws above error, because the setup() function in SchedulerBrowserTestBase.php invokes $this->getName(), the getName function exists until PHPUnit 9.5, but it doesn't exists on PHPUnit 10.
So, as an alternative, we should use $this->toString() method.
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 #4
deepakkm commentedComment #5
vishalkhode commentedReviewed changes and looks good to me.
Comment #6
jonathan1055 commentedChanged parent to related issue.
The phpunit tests all fail at D11. That is not necessarily the fault of this MR, but the overall 'next major' testing needs to be sorted out before I can release a Drupal 11 compatible version of Scheduler.
Comment #7
vishalkhode commentedHi @jonathan1055
Yes, there are couple of Drupal 11 tests failing (not all). I've described the complete Drupal 11 status here. Also, I've added some commits in #3434325: Drupal 11 compatibility fixes [2.x] to run PHPUnit tests on Drupal 11. Can we merge changes for this ticket as we need to fix this for Drupal 11.
Comment #10
jonathan1055 commentedThanks for making this MR. Just checked locally and using toString() actually provides more information than we had before.
getName() returns
testViewScheduledContentOverview with data set "#commerce_product"toString() returns
Drupal\Tests\scheduler\Functional\SchedulerViewsAccessTest::testViewScheduledContentOverview with data set "#commerce_product" ('commerce_product', 'test_product')But this should not affect the outcome of the
stristr()conditionComment #12
jonathan1055 commentedPreviously we had errors in PHPstan
and with this MR the PHPstan Next Major is green and clean.
The PHPUnit tests also all had
and these are now solved with this MR.
Also, the tests pass at Current and Previous Major (so we maintain backwards compatibility with Drupal 9.5)
Thank you @deepakkm and @vishalkhode. Merged and fixed.