Thanks for this wonderful module, creating an issue here so we can track progress on this issue.
The Drupal 9 readiness tool for modules ("mglaman/drupal-check": "^1.0" https://github.com/mglaman/drupal-check) correctly flags several of the PHPUnit test associated with CAS module as using deprecated code.
8 Line modules/contrib/cas/tests/src/Unit/CasPropertyBagTest.php
9 ------ -----------------------------------------------------------
10 26 Call to deprecated method readAttribute() of class
11 PHPUnit\Framework\Assert:
12 https://github.com/sebastianbergmann/phpunit/issues/3338
13 27 Call to deprecated method readAttribute() of class
14 PHPUnit\Framework\Assert:
15 https://github.com/sebastianbergmann/phpunit/issues/3338
16 40 Call to deprecated method readAttribute() of class
17 PHPUnit\Framework\Assert:
18 https://github.com/sebastianbergmann/phpunit/issues/3338
19 41 Call to deprecated method readAttribute() of class
20 PHPUnit\Framework\Assert:
21 https://github.com/sebastianbergmann/phpunit/issues/3338
22 53 Call to deprecated method readAttribute() of class
23 PHPUnit\Framework\Assert:
24 https://github.com/sebastianbergmann/phpunit/issues/3338
25 68 Call to deprecated method readAttribute() of class
26 PHPUnit\Framework\Assert:
27 https://github.com/sebastianbergmann/phpunit/issues/3338
28 ------ -----------------------------------------------------------
29
30 ------ ---------------------------------------------------------------------
31 Line modules/contrib/cas/tests/src/Unit/Routing/CasRouteEnhancerTest.php
32 ------ ---------------------------------------------------------------------
33 98 Call to deprecated method assertArraySubset() of class
34 PHPUnit\Framework\Assert:
35 https://github.com/sebastianbergmann/phpunit/issues/3494
36 ------ ---------------------------------------------------------------------
37
38 ------ -------------------------------------------------------------------
39 Line modules/contrib/cas/tests/src/Unit/Service/CasProxyHelperTest.php
40 ------ -------------------------------------------------------------------
41 232 Call to deprecated method setExpectedException() of class
42 Drupal\Tests\UnitTestCase:
43 in drupal:8.8.0 and is removed from drupal:9.0.0.
44 Backward compatibility for PHPUnit 4 will no longer be supported.
45 ------ -------------------------------------------------------------------
46
47 ------ -------------------------------------------------------------------
48 Line modules/contrib/cas/tests/src/Unit/Service/CasUserManagerTest.php
49 ------ -------------------------------------------------------------------
50 202 Call to deprecated method setExpectedException() of class
51 Drupal\Tests\UnitTestCase:
52 in drupal:8.8.0 and is removed from drupal:9.0.0.
53 Backward compatibility for PHPUnit 4 will no longer be supported.
54 255 Call to deprecated method setExpectedException() of class
55 Drupal\Tests\UnitTestCase:
56 in drupal:8.8.0 and is removed from drupal:9.0.0.
57 Backward compatibility for PHPUnit 4 will no longer be supported.
58 389 Call to deprecated method setExpectedException() of class
59 Drupal\Tests\UnitTestCase:
60 in drupal:8.8.0 and is removed from drupal:9.0.0.
61 Backward compatibility for PHPUnit 4 will no longer be supported.
62 480 Call to deprecated method setExpectedException() of class
63 Drupal\Tests\UnitTestCase:
64 in drupal:8.8.0 and is removed from drupal:9.0.0.
65 Backward compatibility for PHPUnit 4 will no longer be supported.
66 ------ -------------------------------------------------------------------
67
68 ------ -------------------------------------------------------------------
69 Line modules/contrib/cas/tests/src/Unit/Service/CasValidatorTest.php
70 ------ -------------------------------------------------------------------
71 283 Call to deprecated method setExpectedException() of class
72 Drupal\Tests\UnitTestCase:
73 in drupal:8.8.0 and is removed from drupal:9.0.0.
74 Backward compatibility for PHPUnit 4 will no longer be supported.
75 ------ -------------------------------------------------------------------
76
77 [ERROR] Found 13 errors
Rewrite of tests needed according to this blog post by PHPUnit maintainer https://thephp.cc/news/2019/02/help-my-tests-stopped-working#assertarray...
Comments
Comment #2
trackleft2Comment #3
bkosborneThanks for reporting! I'll be sure to get to this in the coming months.
Comment #4
trackleft2Replaced all readAttribute() instances with getters.
Replaced assertArraySubset() with more specific tests.
See https://www.drupal.org/project/cas/issues/3124245 for setExpectedException() .
See https://www.drupal.org/project/cas/issues/3124254 for $defaultTheme
Comment #6
trackleft2getPgt is a function, adding ()
Comment #7
trackleft2Comment #8
xem8vfdh commentedI believe there is also acomposer.jsonchange that should be made to add the Drupal 9 support badge to the module's main page, as explained here: https://www.drupal.org/project/auto_entitylabel/issues/3111526EDIT: or perhaps the change needs to be made to thecore_version_requirementfield in the module's.infofile. Here's an example from another project: https://www.drupal.org/files/issues/2020-03-12/3119389-d9-upgrade-2.patchEDIT 2: My info above is incorrect, apologies.
Comment #9
xem8vfdh commentedComment #10
trackleft2@xeM8VfDh I probably haven't had enough coffee this morning, but what I think you are saying is that we should update the info file with v9 compatibility now that we've resolved all of the drupal deprecation warnings?
CAS already says it is compatible with v9 here: https://git.drupalcode.org/project/cas/-/blob/8.x-1.x/cas.info.yml#L5 and is, as long as you don't run any phpunit tests.
Comment #11
xem8vfdh commentedhey @trackleft. I think I was wrong about the composer and info changes. Apparently there is some switch a module maintainer can flip somewhere that marks their module as being D9 compatible, and show the aforementioned badge. I am not sure where that switch is, since I'm not a maintainer. Sorry.
Comment #12
trackleft2No problem at all @xeM8VfDh
Comment #13
xem8vfdh commentedI applied 3110204-6-forward-compatibility-drupal-check.patch against 8.x-1.x and received the following warnings/errors:
Before I applied the patch, I got 15 errors from drupal check. When I ran it again after applying the patch, I get these remianing 8:
I'm attaching 3110204-7.patch, which includes the changes from 3110204-6-forward-compatibility-drupal-check.patch and also resolves the deprecations noted above:
When I reapplied my patch against 8.x-1.x, I did not get the same warnings/errors I did with 3110204-6-forward-compatibility-drupal-check.patch.
Comment #14
bkosborneThank you all very much for your work on this. I really appreciate it. I verified the test fixes and am committing.