Problem/Motivation
The test bot fails to install freelinking because the info.yml file does not contain the new core_version_requirement key. As well, the freelinking_prepopulate module will need to be updated, but will not work until prepopulate is ready for Drupal 9.0.x as well.
Current tests are not passing for Drupal 8.9.x - https://www.drupal.org/pift-ci-job/1446496.
Proposed resolution
First set the key, and set the value to ^8 || ^9. Then see what else fails. We should not need to make any major architectural changes at the moment, but only aim to fix deprecation failures that pop up.
| Deprecation |
Fix |
Can Fix? |
| Usage of deprecated trait Drupal\Tests\taxonomy\Functional\TaxonomyTestTrait in class Drupal\Tests\freelinking_prepopulate\Functional\FreelinkingPrepopulateTest |
Use \Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait instead |
Yes |
| Interface Drupal\freelinking\Plugin\FreelinkingPluginInterface extends deprecated interface Drupal\Component\Plugin\ConfigurablePluginInterface |
Use \Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait instead |
Yes |
| Call to deprecated function file_unmanaged_copy() |
Use \Drupal\Core\File\FileSystemInterface::copy() |
Yes |
Ignore any test failures of freelinking_prepopulate.
Remaining tasks
Write an initial patch, and make sure that the tests run on Drupal 9 and Drupal 8.
Comments
Comment #2
mradcliffeAdded a note about current test run on 8.9.x. I've seen this test fail before locally, but not on the test bot. There could be some new thing that the test suite needs to do in order to save nodes.
Comment #3
fazni commentedComment #4
fazni commentedComment #5
fazni commentedComment #6
gayathri j commentedAdded core_version_requirement key in info.yml file for freelinking module please review.
Comment #7
gayathri j commentedPlease ignore #6 i created new patch.
Comment #8
mradcliffeThank you for all the patches, @fazni! This will help move this forward a bit. @J.Gayathri, the patch in #7 seems to be the same in #3. Thank you for adding it though as that helps confirm @fazni's work.
I've seen this error before and now that I've taken a closer look it's probably due to Content Translation changes in Drupal 8. Here's a patch that might help fix the test failure, but it will probably fail in another area. It will get tricky after this because of the deprecation in 8.7.0 that cannot be removed until 8.7 is out of support. So I'm going to remove the novice tag for now. That doesn't mean that someone couldn't continue on working on it.
Comment #9
mradcliffeOkay, it was only my local environment. Running drupal-check on the code base I found the following 3 deprecations that need to be addressed.
I think this is novice again. The next step is to fix the deprecations. The most complex one is going to be ConfigurableInterface. The new suggestion to implement both interfaces is going to be important here and that should be the route to take to implement
Comment #10
-enzo- commentedHi folks.
Attached you could find a patch to address the last three remaining issues.
Comment #11
mradcliffeThank you for the new patch, @-enzo-!
It looks like the patch is failing tests. See below. I guess, don't worry about testing on 9.0.x branch for now as prepopulate module doesn't have the core_version_requirement key either.
We won't be able to use this method statically and this is being called on an interface.
Instead we need to get the file_system service,
\Drupal::service('file_system'), which is an instance of FileSystem that implements FileSystemInterface.Then we can call the copy method using the
->instance operator rather than the static operator.Comment #12
-enzo- commentedHi @mradcliffe
Thanks for the review
Attached you can find a new version with his interdiff
Comment #13
mradcliffeThe tests here will probably fail so I won't flip the issue to Needs review, but generally when uploading a new patch, remember to change the status to Needs review so that the drupal.org testing infrastructure will automatically test the patch. If the issue is in a different status, then it won't be tested.
Remember, we still need to instantiate the service.
If we take a look at the Change Record for file_unmanaged_copy we should be able to use
\Drupal::service('file_system')->copy()You have the right idea in your initial work with the interface, but we can't call a method on an interface.
Comment #14
-enzo- commentedHI @mradcliffe
Thanks for the revision, in the patch the instantiation is not visible, but in the code was already there
You can see the code at gitlab https://git.drupalcode.org/project/freelinking/blob/8.x-3.x/tests/src/Fu... , this is before the patch
Comment #15
mradcliffeThank you for pointing that out, @-enzo-.
I changed the issue status to Needs review so that your latest patch will run through the tests for 8.9.x.
Comment #16
mradcliffeAt some point logo.png was removed from bartik. It looks like logo.svg has existed since 2015 so that seems like it's safe.
I also found that $root_path is an empty string when I ran locally so maybe just try a relative path:
$image_path = 'core/themes/bartik/logo.svg';and remove$root_path. And update the assertions.Comment #17
-enzo- commentedAttached you could find the patch and interdiff with the changes suggested, thank you for your revision
Comment #18
mradcliffeChanging to Needs review.
Comment #20
mradcliffeThank you, @-enzo-, @J.Gayathri, @fazni for working on this.
I have committed the patch to 8.x-3.x.
Comment #21
gayathri j commentedIt's good to see this feature moving forward.
Thanks all.