Closed (fixed)
Project:
YouTube Field
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
24 Mar 2019 at 00:32 UTC
Updated:
7 Jun 2020 at 21:41 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
sergiu stici commentedHere is the patch, please review.
Comment #3
vuilComment #4
amateichuk commentedPatch based on #2 + replaced deprecated const
Comment #5
vuil#4 make sense. It works for us.
Comment #7
guschilds commentedI've committed the patch to the 8.x-1.x branch and it will be a part of the next release. I also committed the addition of
core_version_requirementto the module's info file, so at this point the module should be fully compatible with Drupal 9. Thanks everyone!Comment #9
asya_asina commentedThis task is still relevant. I checked the code using drupal-check tools. And drupal-check showed follow results:
------ ------------------------------------------------------------------------------------------------
Line src/Tests/YouTubeTest.php
------ ------------------------------------------------------------------------------------------------
12 Class Drupal\youtube\Tests\YouTubeTest extends deprecated class Drupal\simpletest\WebTestBase:
in drupal:8.8.0 and is removed from drupal:9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
34 Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
in drupal:8.8.0 and is removed from drupal:9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
------ ------------------------------------------------------------------------------------------------
------ ---------------------------------------------------------------------
Line youtube.module
------ ---------------------------------------------------------------------
377 Call to deprecated function file_scan_directory():
in drupal:8.8.0 and is removed from drupal:9.0.0.
Use \Drupal\Core\File\FileSystemInterface::scanDirectory() instead.
------ ---------------------------------------------------------------------
Comment #10
guschilds commentedThanks for the heads up. Looks like both were deprecated in 8.8. Reopening.
Comment #11
tapaswini sahoo commentedComment #12
tapaswini sahoo commentedI already applied patch kindly review it.
Comment #13
tapaswini sahoo commentedComment #14
tapaswini sahoo commentedComment #15
guschilds commentedThanks for the patch tapaswini sahoo! I haven't yet applied and tested it, but one issue I'm seeing:
A space is missing after the
=. This coding standard is discussed here and could also be detected using something like PHPCS.Could you fix that? Thanks again!
Comment #16
tapaswini sahoo commentedComment #17
tapaswini sahoo commentedComment #18
tapaswini sahoo commentedHere i applied patch and interdiff also kindly review it please.
Comment #19
lisa.rae commentedVerified that this patch addressed Drupal 9 compatibility issues.
Comment #20
guschilds commentedThanks for the patches. While this may pass drupal-check, it looks like the switch from WebTestBase to BrowserTestBase may be more involved than this. See here: https://www.drupal.org/docs/8/testing/converting-d7-and-d8-simpletests-t...
Does more need to be done here to update these tests and organize them in the right files and directories? Or am I misunderstanding?
Comment #21
guschilds commentedComment #22
kapilv commentedComment #23
kapilv commentedComment #25
guschilds commentedThanks for the patches. I have pushed a commit to replace
file_scan_directory(). I gave myself authorship because the submitted patches did not contain valid code that worked, so I had to fix that.There is still the outstanding issue of converting the WebTestBase test to a BrowserTestBase test. Multiple patches have been submitted that replace the class names, but as mentioned, I believe there is more to it than that, as outlined here: https://www.drupal.org/docs/8/testing/converting-d7-and-d8-simpletests-t...
If you're going to submit a patch or mark one as RTBC, please confirm that you've read that documentation and have gotten the BrowserTestBase test to run and pass.
Comment #27
guschilds commentedI was able to convert the tests to BrowserTestBase. Committed. That should cover everything at the moment.
Thanks again everyone. Marking as Fixed.
Comment #29
ttnt commentedHello,
Sorry to reopen but it seems there is still an issue in Drupal 9. It causes a WSOD on the settings page.
Uncaught PHP Exception Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException: "You have requested a non-existent service "entity.manager"." at /core/lib/Drupal/Component/DependencyInjection/Container.php line 151
I found the reference here:
youtube/youtube.module:470: $entity_manager = \Drupal::service('entity.manager');
youtube/youtube.module:471: $field_map = $entity_manager->getFieldMap();
When I do:
- $entity_manager = \Drupal::service('entity.manager');
+ $entity_manager = \Drupal::service('entity_type.manager');
I get:
Error: Call to undefined method Drupal\\Core\\Entity\\EntityTypeManager::getFieldMap()
I'm not an expert here, but as the error changed, I assume that's the smoking gun for the WSOD :).
Thanks!
Comment #30
ttnt commentedThis seems to have fixed it:
youtube.module line 470:
No clue if this is the correct way of doing things?
Comment #31
guschilds commentedHi herrzhull,
Good catch. Thanks for reporting it and for investigating and including a potential fix. Your hunch was right. If you look at the 8.x docs for EntityManager::getFieldMap, you'll see a comment about its (long ago) deprecation and how to find the fix. Sure enough, that method was just calling
\Drupal::service('entity_field.manager')->getFieldMap();, so calling the same thing here was the way to go. I've committed this fix to the 8.x-1.x branch (b7c37d34).