Problem/Motivation
Drupal 9 is coming! We need to make sure that Simple Google Maps module is fully Drupal 9 compatible.
Proposed resolution
Tasks:
- Run phpstan or other analysis tools to see if we are calling any deprecated code or have other D9 compatibility problems.
- If so, fix them in a patch.
Check performed against branch 8.x-1.x at commit hash 180e2a5d674b88ff176ac6ba88f35864b922211a
------ --------------------------------------------------------------------------
Line src/Tests/SimpleGmapTest.php
------ --------------------------------------------------------------------------
49 Call to deprecated method entityManager() of class Drupal:
in Drupal 8.0.0 and will be removed before Drupal 9.0.0.
Use \Drupal::entityTypeManager() instead in most cases. If the needed
method is not on \Drupal\Core\Entity\EntityTypeManagerInterface, see the
deprecated \Drupal\Core\Entity\EntityManager to find the
correct interface or service.
------ --------------------------------------------------------------------------
[ERROR] Found 1 error
Remaining tasks
Make sure the above notice is the only problem.
Write patch.
User interface changes
None.
API changes
None.
Data model changes
None.
Release notes snippet
None.
Comments
Comment #2
jhodgdonLet's expand this issue to be "Make this module fully compliant with Drupal 9".
Comment #3
jhodgdonComment #4
eric heydrichChecked with drupal-check and this is the only error:
------ ------------------------------------------------------------
Line src\Tests\SimpleGmapTest.php
------ ------------------------------------------------------------
49 Call to deprecated method entityManager() of class Drupal.
------ ------------------------------------------------------------
Comment #5
eric heydrichBuilt a patch for the one open problem.
Comment #6
eric heydrichComment #7
eric heydrichUpdate the patch with core_version_requirement to support Drupal 9
Comment #8
eric heydrichComment #9
casaran commentedPatch is failing. Changing to correct status.
Comment #10
eric heydrichRechecked against Drupal 8.9 and got following errors:
[2K 3/3 [============================] 100%
------ -------------------------------------------------------------------------------------------------------
Line src\Tests\SimpleGmapTest.php
------ -------------------------------------------------------------------------------------------------------
17 Class Drupal\simple_gmap\Tests\SimpleGmapTest extends deprecated class Drupal\simpletest\WebTestBase.
45 Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase.
49 Call to deprecated method entityManager() of class Drupal.
------ -------------------------------------------------------------------------------------------------------
[ERROR] Found 3 errors
Comment #11
-enzo- commentedHi Folks
I applied the patch in #8 and did some changes an looks like we are ready for Drupal 8.8 and 9
Tested with Drupal 8.8
Comment #12
jhodgdonExcept that the test doesn't pass.
Comment #13
joshi.rohit100Test case is failing because BrowserTestBase doesn't have drupalPostAjaxForm() method.
Replaced drupalPostAjaxForm() with drupalPostForm().
I also noticed while running tests on local that tests throwing warning for "\Drupal::service('entity.definition_update_manager')->applyUpdates();" as this is depractaed.
I am wondering if below is really required?
Comment #14
amitgoyal commentedPatch in #13 looks good to me.
Not really sure if "\Drupal::service('entity.definition_update_manager')->applyUpdates();" is needed or not as per comment above.
Comment #15
jhodgdonIf you are getting an error when running the test locally, that something is deprecated, it is probably a good idea to remove it. Setting to Needs Work for that. Thanks!
Comment #16
joshi.rohit100Comment #17
amitgoyal commentedThanks Rohit, #16 looks good to me.
Comment #18
jhodgdonThis whole patch seems wrong, actually:
- Tests that are BrowserTestBase should be under (module directory)/tests/src
- Tests that use Ajax should be converted to JavascriptTestBase, not BrowserTestBase.
I'm not as familiar with this test for the Drupal 8/9 version of the module, but in the Drupal 7 version, the test basically was there so that we could run it interactively and look at the results to see the maps visible. @martin107 -- not sure if you use the Drupal 8 test that way? Assigning this to you to reply.
In any case, this is wrong. See https://www.drupal.org/docs/8/phpunit for more info on phpunit tests in Drupal 8/9.
Comment #19
jhodgdonThere's a different patch for the test on #2913307: Prepare Tests for upgrade. -- not done but seems to be pointing in a better direction. Maybe we should limit this patch to the line in the .info.yml file and continue on the test in that other issue? Otherwise close that as a duplicate of this one.
Comment #20
jhodgdon@martin_107 is now working on the tests on the other issue. So let's remove the tests from this patch, and also (since the title is "make sure fully compatible" on this issue, postpone this issue until the other one is done.
Comment #21
chr.fritschCool, the tests are done. And it seems that there is nothing else to do. So the only missing thing is a new release, now.
Comment #22
martin107 commentedSo I have looked through several articles online about preparing for Drupal9
They seem to repeat a simple check list
1) Make sure no errors are reported by drupal-check.
2) Sort out the simple_gmap.info.yml with respect to "core_version_requirement: ^8 || ^9"
3) ...release?
I am pausing with step 3, is Drupal8.9 frozen yet? I could not immediately gleam that from the articles.
.. that is are we currently just in sync with Drupal9's current status?
If things are not frozen then there could be future changes in Core for which we must adjust.
I agree a release seems appropriate - as a signal to a broader audience that the readiness of the module has improved.
I am not sure of the wording for the release ...
Are we "Drupal9 aligned" or "Drupal9 compatibility guaranteed".
What would other consumers of this module like to be told in the release notes.
In terms of planning, feedback is welcome, and then perhaps I will trigger a release early next week?
Comment #23
jhodgdonAdd to checklist: run tests against D9? and no D9 is not frozen.
Comment #24
chr.fritschBut there won‘t be any new deprecations in D8. So we have fixed everything
Comment #25
martin107 commentedThank you both for the feedback
Carefully parsing the language, from the internet and what you have said
.... there are two separable points.
1) Not frozen.
2) Drupal 8.9 by design won't carry any new deprecation....
With those objectives there is still plenty of possibility for unforeseen screw ups.
So I will rerun test on D9 and then the tone of the text I use in the new release notes will speak of a "release candidate 1" as far as Drupal9 compatibility goes.
That seems the best way of preventing needless car crashes for site owners, who are not following the comings and goings of core development.
Fingers crossed, I have time for release on Sunday night.
Comment #26
jhodgdonThat sounds good to me! Anyway I think the branch/version can still say 8.x-something, and with the changes already committed (??) to the info file the new release should be compatible with 8.x.several, plus 9.x.... Actually, I amend my suggestion in #23 ... I suggest going to the Automated tests tab of this project and testing against the oldest version of 8.x we want to support, and also against 9.x, before making release. Info file currently says:
core_version_requirement: ^8 || ^9It probably should be more specific on 8.x? https://www.drupal.org/node/3070687
Comment #27
martin107 commentedGiven that we are now pre-compatible with D9, I have bumped the major number and released
https://www.drupal.org/project/simple_gmap/releases/8.x-2.0
I will be updateing the front page and tweaking the automated test strategy, next.
Thank you all for your patience ..most of the delays related to this issue have been on my account.