See Gábor Hojtsy’s blog post about testing for Drupal 9 compatibility. Basically, we just want to make sure that we’re not using any deprecated functionality, as that’s (supposedly) the only thing that will change with Drupal 9.0.0.
We can’t really commit the patch enabling these tests, but it can be tested by the test bot within this issue regularly to determine where we stand.

Not sure which branch to run it against, though? After all, we can’t really get rid of code deprecated in 8.7.x until we depend on that. On the other hand, testing against 8.6.x (or even 8.5.x, if that’s now supported for longer) will permanently keep us behind, so that we might not be prepared once 9.0.0 hits after all.
Best see what comes up and adapt accordingly, I’d say.

Also see #3023168: Properly mark deprecated methods for properly marking deprecated methods in our own module.

For my future reference: xclip -o | grep '[0-9]x: ' | sed 's/ \+[0-9]\+\+x: //' | sort | uniq to quickly get a unique list of all deprecations we hit.

CommentFileSizeAuthor
#56 3023170-56--prepare_for_drupal_9.patch23.25 KBBerdir
#55 3023170-55--prepare_for_drupal_9-interdiff.txt2.14 KBBerdir
#55 3023170-55--prepare_for_drupal_9.patch23.24 KBBerdir
#50 3023170-50--prepare_for_drupal_9.patch21.2 KBdrunken monkey
#50 3023170-50--prepare_for_drupal_9--with_deprecation_tests.patch21.85 KBdrunken monkey
#50 3023170-50--prepare_for_drupal_9--interdiff.txt1.1 KBdrunken monkey
#48 3023170-48--prepare_for_drupal_9.patch20.1 KBdrunken monkey
#48 3023170-48--prepare_for_drupal_9--with_deprecation_tests.patch20.75 KBdrunken monkey
#48 3023170-48--prepare_for_drupal_9--interdiff.txt3.52 KBdrunken monkey
#46 interdiff-3023170-43-36.txt4.63 KBphenaproxima
#46 3023170-46.patch21.39 KBphenaproxima
#43 3023170-43--prepare_for_drupal_9.patch16.58 KBdrunken monkey
#42 3023170-42--prepare_for_drupal_9.patch32.07 KBdrunken monkey
#42 3023170-42--prepare_for_drupal_9--interdiff.txt365 bytesdrunken monkey
#39 3023170-39--prepare_for_drupal_9.patch32.1 KBdrunken monkey
#39 3023170-39--prepare_for_drupal_9--with_deprecation_tests.patch24.21 KBdrunken monkey
#39 3023170-39--prepare_for_drupal_9--interdiff.txt8.9 KBdrunken monkey
#38 3023170-38--prepare_for_drupal_9.patch23.56 KBdrunken monkey
#38 3023170-38--prepare_for_drupal_9--with_deprecation_tests.patch24.21 KBdrunken monkey
#38 3023170-38--prepare_for_drupal_9--interdiff.txt1.62 KBdrunken monkey
#33 3023170-33--fix_8_8_deprecations.patch44.19 KBdrunken monkey
#33 3023170-33--fix_8_8_deprecations--interdiff.txt1.48 KBdrunken monkey
#30 3023170-30--fix_8_8_deprecations.patch44.65 KBdrunken monkey
#27 interdiff.txt14.95 KBpfrenssen
#27 3023170-27.patch44.63 KBpfrenssen
#19 3023170-19--fix_8_8_deprecations--interdiff.txt2.87 KBmilindk
#19 3023170-19--fix_8_8_deprecations.patch29.85 KBmilindk
#18 3023170-remaining_fixes_8_7_deprecations.patch3.1 KBmilindk
#15 3023170-15--fix_8_8_deprecations.patch27.15 KBdrunken monkey
#15 3023170-15--fix_8_8_deprecations--interdiff.txt7.12 KBdrunken monkey
#15 3023170-15--fix_8_7_deprecations.patch21.02 KBdrunken monkey
#15 3023170-15--fix_8_7_deprecations--interdiff.txt1.31 KBdrunken monkey
#13 3023170-13--fix_all_deprecations_for_8_7.patch19.71 KBdrunken monkey
#13 3023170-13--fix_all_deprecations_for_8_7--interdiff.txt1.37 KBdrunken monkey
#11 3023170-11--fix_all_deprecations_for_8_7.patch20.78 KBdrunken monkey
#11 3023170-11--fix_all_deprecations_for_8_7--interdiff.txt489 bytesdrunken monkey
#10 3023170-10--fix_all_deprecations_for_8_7.patch20.55 KBdrunken monkey
#10 3023170-10--fix_all_deprecations_for_8_7--interdiff.txt741 bytesdrunken monkey
#8 3023170-8--fix_all_deprecations_for_8_7.patch28.6 KBdrunken monkey
#8 3023170-8--fix_all_deprecations_for_8_7--interdiff.txt15.49 KBdrunken monkey
#7 3023170-6--fix_all_deprecations_for_8_7.patch15.57 KBdrunken monkey
#4 3023170-4--fix_all_deprecations_for_8_7.patch19.17 KBdrunken monkey
#2 3023170-2--test_for_drupal_9_compatibility.patch664 bytesdrunken monkey
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drunken monkey created an issue. See original summary.

drunken monkey’s picture

Status: Needs review » Needs work

The last submitted patch, 2: 3023170-2--test_for_drupal_9_compatibility.patch, failed testing. View results

drunken monkey’s picture

Status: Needs work » Needs review
FileSize
19.17 KB

Alright, looks pretty good. We already have #2986222: Switch JS tests to WebDriverTestBase lined up for getting rid of the deprecated JavascriptTestBase, and PublishComment seems like it’s the fault of Core (still triggered, of course, every time a comment is published). Which would take care of 8.6.

For 8.7, we already have #3020185: Adapt SearchApiConverter to deprecations in EntityConverter to take care of the EntityConverter deprecations. With #3023246: Update references to EntityReferenceTestTrait, #3023247: Update references to NodeCreationTrait and #3023255: Do not attempt to install schema system.router in tests, 8.7 should also be fine. (The latter two can even be committed right away – they adapt to changes we apparently just missed, in earlier versions.)

The attached patch combines the latest patches from all of these issues with the one here, to see where we stand for 8.7.

Status: Needs review » Needs work

The last submitted patch, 4: 3023170-4--fix_all_deprecations_for_8_7.patch, failed testing. View results

drunken monkey’s picture

drunken monkey’s picture

drunken monkey’s picture

That should take care of all the new ones (except PublishComment, which we can’t do anything about, and our own DisplayInterface::getUrl(), which we test on purpose.

geek-merlin’s picture

> and PublishComment seems like it’s the fault of Core (still triggered, of course, every time a comment is published)

Stumbled on this when working on the tests in the other issue. That CR is not too instructive, but reading the source enlightened me.

We have to replace "comment_publish_action" with "entity:publish_action:comment" in ProcessorTestBase.php, then the lights are green.

drunken monkey’s picture

Oh, right, it is our fault! Thanks a lot for pointing this out! Seems I should have investigated a bit more there.
However, I think we just copy-pasted that from Core, I don’t think we actually need that action defined? Trying without it, let’s see – otherwise, will replace the plugin ID as suggested. Thanks a lot again, in any case!
(Also, this needed a re-roll.)

drunken monkey’s picture

PHP Fatal error: Trait 'Drupal\Component\Plugin\ConfigurableTrait' not found in /var/www/html/modules/contrib/search_api/src/Plugin/ConfigurablePluginBase.php on line 14

What?!? Don’t really understand that. When testing against 8.8, that trait should definitely be there.
Fixed the coding standards error, let’s try again.
(However, as mpp pointed out on Slack, we might want to split this issue up into patches/issues per Core minor.)

martin107’s picture

Plugin\ConfigurableTrait' not found

What?!? Don’t really understand that.

When I look through the console output

https://dispatcher.drupalci.org/job/drupal8_contrib_patches/790/console

I see that it is not the first error.

failed database connections are bad

in short I think testbot may have failed so I am retesting

09:04:44 ---------------- Starting dbcreate ----------------
09:04:44 Directory created at /var/lib/drupalci/workspace/jenkins-drupal8_contrib_patches-790/ancillary/dbcreate
09:04:44 Attempting to connect to database server.
09:04:44 SQLSTATE[HY000] [2002] Connection refused
09:04:44 Could not connect to database server.
09:04:44 Sleeping 10 seconds to allow service to start.
09:04:54 Attempting to connect to database server.

drunken monkey’s picture

Don’t think that’s really a problem. The very next log line reads: “Database is active.” To me, that seems liks the DB server took a bit longer to start soit had to wait an additional 10 seconds. But no further problem.

The real reason this fails is that #2852463: Create a trait and base class to implement \Drupal\Component\Plugin\ConfigurableInterface got reverted, so that trait really doesn’t exist anymore. So, removing that change again.

Status: Needs review » Needs work

The last submitted patch, 13: 3023170-13--fix_all_deprecations_for_8_7.patch, failed testing. View results

drunken monkey’s picture

OK, new, separate patches for 8.7 and 8.8. (8.8 interdiff is compared to 8.7, 8.7 interdiff is compared to #13.)
Unfortunately, it doesn’t seem like there is a way for us to ignore our own deprecations, which skyrocketed due to #3023704: Convert hooks to events.

Status: Needs review » Needs work

The last submitted patch, 15: 3023170-15--fix_8_8_deprecations.patch, failed testing. View results

drunken monkey’s picture

Excellent, only our own deprecations left in there.

milindk’s picture

milindk’s picture

milindk’s picture

Status: Needs work » Needs review
amitgoyal’s picture

Before applying #19, I was getting 29 errors.

After applying the patch, most of those errors have gone except following which are in search_api.drush.inc,

➜  d9 git:(8.8.x) ✗ vendor/bin/drupal-check -d modules/contrib/search_api


 363/363 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ -------------------------------------------------
  Line   search_api.drush.inc
 ------ -------------------------------------------------
  304    Call to deprecated function drush_get_option().
  305    Call to deprecated function drush_get_option().
  367    Call to deprecated function drush_print().
  385    Call to deprecated function drush_print().
  401    Call to deprecated function drush_print().
  417    Call to deprecated function drush_print().
  435    Call to deprecated function drush_print().
 ------ -------------------------------------------------


 [ERROR] Found 7 errors

Not sure if we are supposed to fix the above errors or not?

joshi.rohit100’s picture

Status: Needs review » Reviewed & tested by the community

Marking this RTBC as the drush errors are from *.drush.inc file which is used by Drush8 only and Drupal9 will use drush 9 which has different setup (service file, command class etc).

pfrenssen’s picture

Status: Reviewed & tested by the community » Needs work

We need to remove the Drush 8 support. Drush 8 is for Drupal 8.3 and lower which is EOL. Ref. https://docs.drush.org/en/master/install/#drupal-compatibility

pfrenssen’s picture

I created a separate ticket for removing Drush 8: #3077570: Remove Drush 8 support from the 8.x branch

pfrenssen’s picture

Status: Needs work » Postponed

Maybe "postponed" is a better status. We can run this test again when #3077570: Remove Drush 8 support from the 8.x branch is in.

pfrenssen’s picture

Status: Postponed » Needs work

I was mistaken, Drush 8 is still supported, but not recommended. We can move the removal of it in here and switch to Drush 10 when Drupal 9 is released.

anavarre’s picture

With the latest patch I'm still seeing 3 lines being flagged. Not sure if this is PHPStan acting up or if there's something to actually fix.

$ drupal-check .
365/365 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
------ --------------------------------------------------------------------------------------------
Line   src/Plugin/search_api/processor/Stopwords.php
------ --------------------------------------------------------------------------------------------
23     Class Drupal\Core\Security\TrustedCallbackInterface not found and could not be autoloaded.
------ --------------------------------------------------------------------------------------------
------ ---------------------------------------------------------------------------------------------
Line   tests/src/Kernel/Processor/AddHierarchyTest.php
------ ---------------------------------------------------------------------------------------------
23     Class Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait not found and could not be autoloaded.
------ ---------------------------------------------------------------------------------------------
------ ---------------------------------------------------------------------------------------------
Line   tests/src/Kernel/Views/TaxonomyTermArgumentTest.php
------ ---------------------------------------------------------------------------------------------
14     Class Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait not found and could not be autoloaded.
------ ---------------------------------------------------------------------------------------------
[ERROR] Found 3 errors
drunken monkey’s picture

(Tagging in preparation of DrupalCon.)

@anavarre: Thanks for pointing this out! I’ll look into it (or someone will in Amsterdam).
I just re-tested the patch against the 8.9.x branch, and it passed fine.

drunken monkey’s picture

FileSize
44.65 KB

Nope, seems you just didn’t test with the latest Drupal Core code? I’m running the latest 8.9 version and the \Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait trait is definitely still there.
Also, the first warning seems completely bogus – there’s no reference to TrustedCallbackInterface in our entire module, unless I’m mistaken.

Anyways, a recent commit did break the 8.8 patch, so posting a re-roll for that.

drunken monkey’s picture

Berdir’s picture

  1. +++ b/src/ParamConverter/SearchApiConverter.php
    @@ -57,7 +62,16 @@ class SearchApiConverter extends EntityConverter implements ParamConverterInterf
       public function convert($value, $definition, $name, array $defaults) {
         /** @var \Drupal\search_api\IndexInterface $entity */
    -    $storage = $this->entityManager->getStorage('search_api_index');
    +    try {
    +      $storage = $this->entityTypeManager->getStorage('search_api_index');
    +    }
    +    // @todo Use a multi-catch once we depend on PHP 7.1+.
    +    catch (InvalidPluginDefinitionException $e) {
    +      return NULL;
    +    }
    +    catch (PluginNotFoundException $e) {
    +      return NULL;
    +    }
    

    the try/catch here isn't rally necessary? I know that phpstorm by default complains about it, but this is a hardcoded entity type provided by this module, if this would fail then you would have much more severe issues.

  2. +++ b/src/Plugin/ConfigurablePluginBase.php
    @@ -16,6 +16,7 @@ abstract class ConfigurablePluginBase extends HideablePluginBase implements Conf
       // useful. Since PHP 5 complains when adding this trait along with its
       // "parent" trait to the same class, we just add it here in case a child class
       // does need it.
    +  // @todo Change this once we depend on PHP 7.0+.
       use PluginDependencyTrait;
    

    Drupal 8.8 now requires 7.0, so I suppose that can be cleaned up?

  3. +++ b/src/Plugin/PluginFormTrait.php
    @@ -38,7 +38,7 @@ trait PluginFormTrait {
        */
       public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
    -    if ($this instanceof DrupalConfigurablePluginInterface) {
    +    if ($this instanceof ConfigurableInterface) {
           $this->setConfiguration($form_state->getValues());
         }
    

    not sure what your plan is on how when you want to commit it, this can be a bit tricky in combination with other modules, if they didn't update yet then this might no longer work. The opposite is also true, if they removed their deprecation then this would be broken. You'd eed to check for both interfaces to be backwards compatible yourself. Ugly stuff.

  4. +++ b/src/Processor/FieldsProcessorPluginBase.php
    @@ -41,7 +42,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
      * - preprocess_query
      */
    -abstract class FieldsProcessorPluginBase extends ProcessorPluginBase implements PluginFormInterface {
    +abstract class FieldsProcessorPluginBase extends ProcessorPluginBase implements PluginFormInterface, TrustedCallbackInterface {
     
    ...
     
    

    this uses TrustedCallbackInterface :)

    I guess the results above were run with Drupal 8.7, where this interface doesn't exist.

  5. +++ b/src/UnsavedIndexConfiguration.php
    @@ -127,15 +130,24 @@ class UnsavedIndexConfiguration implements IndexInterface, UnsavedConfigurationI
    +    try {
    +      return $this->getEntityTypeManager()->getStorage('user')->load($uid);
    +    }
    +    catch (InvalidPluginDefinitionException $e) {
    +      return NULL;
    +    }
    +    catch (PluginNotFoundException $e) {
    +      return NULL;
    +    }
    

    same here. if the user storage doesn't exist then you'd never get here..

Last, again not sure what your plans with this are exactly. what I do in my projects is add a version dependency on drupal:system (>= 8.8), but actually in this case, I think you want to add https://www.drupal.org/node/3070687 to mark it as compatible with ^8.8 | ^9.0, then you should be able to actually install it on D9.

drunken monkey’s picture

Thanks a lot for reviewing!

the try/catch here isn't rally necessary? I know that phpstorm by default complains about it, but this is a hardcoded entity type provided by this module, if this would fail then you would have much more severe issues.

Yes, this is a bit unfortunate. But while having a useless try/catch in the code is surely not optimal, in my opinion it’s still preferrable compared to having the IDE warnings there, training you to ignore them. The more we eliminate bogus warnings, the more useful the remaining ones become because you can then be (relatively) sure that there is actually something wrong there.
In the end, it’s a matter of taste, I’d say.

Drupal 8.8 now requires 7.0, so I suppose that can be cleaned up?

Actually, we’ll already require PHP 7 once we depend on Drupal 8.7 (see #3044782: Increase PHP version requirement to 7.0), so probably having this @todo there is much too late. I now moved it to the other issue.

not sure what your plan is on how when you want to commit it, this can be a bit tricky in combination with other modules, if they didn't update yet then this might no longer work. The opposite is also true, if they removed their deprecation then this would be broken. You'd eed to check for both interfaces to be backwards compatible yourself. Ugly stuff.

Oh, you’re right there. Thanks for catching that.
However, I guess this also means that we could already commit that bit? It only does an instanceof, so a missing class shouldn’t be a problem (except for static analysis tools, perhaps)? See the bc_change_PluginFormTrait patch.

On the other hand, it might also mean we shouldn’t just switch our own plugins over to the new interface but, like the deprecation message suggests, actually implement both for now? What’s your opinion on that?

this uses TrustedCallbackInterface :)

I guess the results above were run with Drupal 8.7, where this interface doesn't exist.

Ah, right! Not sure how I missed that … Anyways, as you say, it will be there in 8.8.

Last, again not sure what your plans with this are exactly. what I do in my projects is add a version dependency on drupal:system (>= 8.8), but actually in this case, I think you want to add https://www.drupal.org/node/3070687 to mark it as compatible with ^8.8 | ^9.0, then you should be able to actually install it on D9.

We always depend on the oldest supported version of Core. That is, once 8.8 is released we’ll up our dependency to 8.7 (since 8.6 is EOL then) and commit all the 8.7 deprecation stuff in here (and other issues). The 8.8 patch won’t be committed until 8.9 (and, in all likelihood, 9.0) is out, so yes, at that point we would of course also mark the module compatible with both releases.

Though I now realize that this would make it impossible for people to evaluate this module, without patching it, with a D9 alpha/beta/RC release, right? Damn, this is really getting complicated …
(Of course, with any new deprecations in 8.9 that would affect us this plan would have been moot anyways. But at least there was some hope that we’d finally resolved this version dependency mess … Now it looks like we might want to create a second branch, or increase the version dependency early, after all.)

drunken monkey’s picture

Berdir’s picture

Core will not add new deprecations in 8.9, and if then only for removal in Drupal 10.

And yes, to be compatible with 9.0, you have to fix 8.8 deprecations as well.

My plan with my modules is to wait a bit after 8.8 but then relatively soon switch to 8.8 as the minimally supported version, to be able to start testing on 9.0. Probably do another 8.7-compatible release before that, if there's anything useful to be released.

If someone wants bugfixes/new features, then they have to update to the latest Drupal core version. 8.6 only has security-support, I'm not sure if there even was an 8.6 release since 8.7 came out, the only ugly thing would be in case you need to do a security release in that timeframe. But you could keep it only in dev for some time, and a security release could be based on the latest release?

drunken monkey’s picture

Thanks for your thoughts on this!
Yes, I guess that will make most sense. It’s not as if I’m super-regular with my releases anyways, so this should work out fine. Having an urgent security release right in this short time frame would then just be immensely bad luck.

Kristen Pol’s picture

Issue tags: -Drupal 9

Per a Slack discussion with Gábor Hojtsy regarding usage of D9 tags (Drupal 9, Drupal 9 compatibility, Drupal 9 readiness, etc.), "Drupal 9 compatibility" should be used for contributed projects that need updating and "Drupal 9" was the old tag for D8 issues before the D9 branch was ready. Doing tag cleanup here based on that discussion.

drunken monkey’s picture

@ Kristen: Thanks!

I created #3098722: Increase Core version requirement to 8.7 as a spin-off to get the 8.7 deprecations in.
Re-rolling the 8.8 (and, with the plan from #35/#36, I guess already 9.0) patch accordingly, plus adding a few more fixes/additions.

drunken monkey’s picture

Huh, weird. The change record leaves the core: key in place in its examples, and I also don’t see a note anywhere that says we have to remove it. But I guess the test bot knows better …
(However, now that I think about it, we should also update all other *.info.yml files contained in this project (Search API DB and all the test modules), right? Doing that as well.)

The remaining three deprecations seem like they could be resolved without requiring Drupal 8.8, actually. I therefore created another spin-off issue: #3099048: Fix Drupal 8.8 deprecations that do not need Drupal 8.8.

Berdir’s picture

> Huh, weird. The change record leaves the core: key in place in its examples, and I also don’t see a note anywhere that says we have to remove it. But I guess the test bot knows better …

The core key must not be used if the you require a specific minor/patch version *and* you can not require a version lower than 8.7.7 with it, because older versions don't support it.

You can see that the second example with 8.8 does not have a core key.

This is explicitly enforced to avoid a possibly broken requirement (requiring 8.8 but you could then still install it on 8.7.6 and earlier as these versions don't check for the new key). You can require just ^8 and combine it with a drupal:system version requirement if you just need 8.6 or so. But you need 8.8 anyway here :)

Berdir’s picture

  1. +++ /dev/null
    @@ -1,449 +0,0 @@
    -
    -/**
    - * Implements hook_drush_command().
    - */
    -function search_api_drush_command() {
    -  $items = [];
    

    I still feel like removing drush8 support could be done separately/later. Having these files around when you use drush 9 shouldn't break anything and we are still on drush8 for most of our projects, so we'd lose access to these commands :) But your decision.

  2. +++ b/search_api.info.yml
    @@ -2,7 +2,7 @@ type: module
     configure: search_api.overview
     dependencies:
    -  - drupal:system (>=8.7.4)
    +  - drupal:system (>=8.8)
    

    the drupal:system dependency can be removed now, core_version_requirement covers that.

drunken monkey’s picture

This is explicitly enforced to avoid a possibly broken requirement (requiring 8.8 but you could then still install it on 8.7.6 and earlier as these versions don't check for the new key). You can require just ^8 and combine it with a drupal:system version requirement if you just need 8.6 or so. But you need 8.8 anyway here :)

Makes perfect sense, thanks for the explanation!
I now see this is also mentioned in the change record after all. Just not very prominently, so I apparently missed it. So, very good that they actually check for that and fail if core: is there – just stating it should be done in the CR is obviously not enough for some. ;)

I still feel like removing drush8 support could be done separately/later. Having these files around when you use drush 9 shouldn't break anything and we are still on drush8 for most of our projects, so we'd lose access to these commands :) But your decision.

Ah, right, makes sense. As we want the module to still work with Drupal 8 until that’s EOL, and Drush 8 still supports Drupal 8, it’s unnecessary to remove Drush 8 support here already.
So, we should probably remove the removal again from this patch, re-open #3077570: Remove Drush 8 support from the 8.x branch and maybe just add @CodeStyleIgnore (or whatever the tag is) to search_api.drush.inc.

Anyone opposed?

the drupal:system dependency can be removed now, core_version_requirement covers that.

Ah, yes, of course. Thanks!

drunken monkey’s picture

amitgoyal’s picture

Status: Needs review » Reviewed & tested by the community

#43 looks good to me.

chr.fritsch’s picture

Since #3096609: Allow contrib test modules to not need a core or core_version_requirement key was committed, there is no need for a core or a core_version_requirement key in the tests.

phenaproxima’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
21.39 KB
4.63 KB

Decided to not change the thing @chr.fritsch pointed out in #46, but I removed some calls to $this->assertInternalType() in tests. It's deprecated in favor of type-specific methods as of PHPUnit 7, I think...but since we don't necessarily consistently have that version of PHPUnit running on testbot, I used $this->assertSame($type, gettype($value)) instead.

John Cook’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +ContributionWeekend2020

I've had a look at the patch in comment #46. Everything looks good.

After running the patched code against drupal-check, the only errors that are reported are for drush. As this is being addressed in #3077570: Remove Drush 8 support from the 8.x branch I'm marking as RTBC.

drunken monkey’s picture

@ chr.fritsch/#45: Thanks for pointing this out, I was not aware of it!
However, the change record explicitly states: “Prior to 8.8.2, the value is required for test modules and will cause site errors if it is not included.” So I don’t think it would be a good idea to omit this. Also, there doesn’t seem to be any real benefit in omitting it, except it saves a bit of time and avoids inconsistencies. As we already have them added correctly in this patch, it seems pointless to remove them again.
Maybe later, when we’d have to change it again, if we can already savely assume everyone is on 8.8.2+, then we might want to remove them instead of keeping them updated, I guess.

@ phenaproxima/#46: I don’t think that change makes sense at this point. First off, we’re concerned about Drupal deprecations, not deprecations in third-party libraries. And second, even for those we’d wait until we can rely on the version with the deprecation already being present, so we can replace the calls with the correct alternative.

However, there is one update to be made to the patch anyways: as Berdir pointed out in #3103570-3: Add $defaultTheme to all our functional tests, the change suggested there cannot in fact be applied before requiring 8.8, so it should be moved to this issue. So, including that in this patch as well now. (Interdiff compared to #43.)

drunken monkey’s picture

Berdir’s picture

There's a new one for theme functions. While it has been changed to a D10 deprecation due to the late enforcement, it's also safe to remove and is very noisy, somehow it's not a suppressed deprecation message in D9:

User deprecated function: Theme functions are deprecated in drupal:8.0.0 and are removed from drupal:10.0.0. Use Twig templates instead of theme_search_api_index(). See https://www.drupal.org/node/1831138 in Drupal\Core\Theme\Registry->processExtension() (line 498 of web/core/lib/Drupal/Core/Theme/Registry.php)"

Berdir’s picture

Also, same as my question in #3121071: Replace theme_inline_entity_form_entity_table() with twig template, I wondering if these could now just be inlined into the respective forms with #type table. Also depends on whether or not you see this as an API change, but going from a theme function to a template would break any customization on this anyway. Either way, makes sense to do this in a separate issue, we'll see about working on it if you confirm about moving them into the forms.

drunken monkey’s picture

Thanks a lot for notifying me about this! As there was no official change record for this (except for the original one for D8, which still claims (amongst other things) that theme functions won’t be available at all in D8), I probably wouldn’t have noticed this.
Converting those theme function usages to just use '#theme' => 'table' instead, where possible, sounds like a very good idea. The less custom theme functions/templates we need the better. I now created an issue for this: #3121637: Replace theme functions with templates. If someone from your company wants to work on that, that would be awesome, of course! The theme layer isn’t really my strong suit.

Berdir’s picture

Thanks for the feedback, we'll have a look at that.

I did run the whole test suite against D9 and found some extra issues.

* The update path test needs to be updated to use the 8.8.0 dump because that's the lowest number that can be updated to Drupal 9
* RenderedItemTest needs an explicit dependency on the path_alias module as that's only automatically installed on D8 in kernel tests (and there's no deprecation message for that). It is a required module and is automatically installed in functional tests.
* \Drupal\Tests\search_api\Unit\Processor\TokenizerTest::testPreprocessSearchQuery failed because it asserted on the old, non-namespaced classs name of MockObject. I updated that, but not 100% sure right now if that will work on D8.8 too but I think so. If not then it could also simply be removed or converted to a @var, it's just there so that method autocomplete/validation works in an IDE.

I also noticed that there some tests that require other contrib modules like search_api_autocomplete and language_fallback_fix, so until these modules also declare themself as D9 compatible you won't be able to run a test run against D9 on DrupalCI.

Berdir’s picture

this conflicted with #3044782: Increase PHP version requirement to 7.0, and since this now requires 8.8 which also requires PHP 7.0, I've removed the explicit php: 7.0 part again.

drunken monkey’s picture

Thanks a lot for the new updates, much appreciated!
As discussed on Slack, I’m currently going through my baclog of newly created issues (unfortunately still around 20 to go), then tag a new 8.7-compatible release and then commit this.

One question before that, though, up for general discussion and input:
As I see that semantic versioning is now finally supported for contrib modules, too, do you think I should create a new 2.x branch after the 8.x-1.16 release and work from there from now on?
Calling it 8.x-1.x still, when D9 is already supported, doesn’t make much sense. Plus, we really do plan to remove some BC code once we switch to Drupal 9, so a major version bump would be in order anyways. (But maybe only once we really do remove the BC stuff? Then maybe we should just change all our deprecations notices accordingly, to put 2.0.0 as the new “removed by” version.)

Hm, or is the move to a 2.x branch another topic anyways and should be discussed in a separate issue?

Berdir’s picture

On the major version, can't provide that much input. I personally have no plans to push out new major versions of my modules any time soon. It does create considerable overhead both for the maintainer and users to switch to a new major version. you'll either need to mark the old branch as unsupported or at least provide eventual security updates for it and so on.

> Calling it 8.x-1.x still, when D9 is already supported, doesn’t make much sense.

That's going to be very common for now. As far as composer is concerned, it's already just 1.x, I could imagine that drupal.org UI could be updated at some point to start cutting of the 8.x- prefix in the UI to remove that confusion. We'll see.

  • drunken monkey committed 0a126be on 8.x-1.x
    Issue #3023170 by drunken monkey, Berdir, milindk, pfrenssen,...
drunken monkey’s picture

Component: Tests » General code
Status: Needs review » Fixed

Alright, I just created release 8.x-1.16, so nothing’s in the way of this little beauty.
Committed. This module is now officially 100% compatible with Drupal 9 (I hope)!
Thanks a lot once again to everyone here who helped, especially Berdir!

Created #3126115: Create a 2.0.0 release and #3126116: Change deprecations to be removed for 2.0.0, not 9.x-1.0 as follow-ups regarding the next major version. It’s really quite independent from this issue, now.

Status: Fixed » Closed (fixed)

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

Kristen Pol’s picture

Thanks for the great work!

Nitpick: Although the issue is crossed out indicating it's fixed, the project page says:

The module’s dev version will soon be made fully compatible with Drupal 9 (see #3023170: Test for compatibility with Drupal 9).

so the text could be updated with the exciting news. :)

jmoreira’s picture

Any updates to when we'll have a release for this? Currently if I'm using Search API Solr on D9 it pull the dev version which can't be installed because Search API Solr has a version condition for this module: search_api:search_api (>=8.x-1.15).

Berdir’s picture

composer should allow 1.x-dev as being compatible with that and search_api_solr 4.x removed that version dependency afaik, from the .info.yml at lesat.

jmoreira’s picture

@Berdir, yes, Composer pulls 1.x-dev fine, but I can't enable the module on Drupal because Drupal doesn't recognize dev versions (https://www.drupal.org/project/drupal/issues/1013302): I get the message: "incompatible with version )". See this issue for more info: https://www.drupal.org/project/search_api_solr/issues/3142313

Also, both V3 (which is the one I'm actually using because I'm working on Acquia Search Solr) and V4 (https://git.drupalcode.org/project/search_api_solr/-/blob/4.x/search_api...) have this dependency.