Problem/Motivation
drupal-check results on commit hash: 7649aa25d500c5ce3cd56d87f41fc143e9bfa323
------ ---------------------------------------------------------------------------------------------------
Line src/EntityEmbedDisplay/EntityEmbedDisplayManager.php
------ ---------------------------------------------------------------------------------------------------
32 config:entity_view_mode_list cache tag might be unclear and does not contain the cache key in it.
------ ---------------------------------------------------------------------------------------------------
------ -------------------------------------------------------------------------------
Line src/Form/EntityEmbedDialog.php
------ -------------------------------------------------------------------------------
380 Call to deprecated method link() of class Drupal\Core\Entity\EntityInterface.
385 Call to deprecated method url() of class Drupal\Core\Entity\EntityInterface.
775 Call to deprecated method strlen() of class Drupal\Component\Utility\Unicode.
------ -------------------------------------------------------------------------------
------ ---------------------------------------------------------------------------------------
Line tests/src/Functional/EntityEmbedDialogTest.php
------ ---------------------------------------------------------------------------------------
28 Call to deprecated method assertResponse() of class Drupal\Tests\BrowserTestBase.
30 Call to deprecated method assertResponse() of class Drupal\Tests\BrowserTestBase.
34 Call to deprecated method assertResponse() of class Drupal\Tests\BrowserTestBase.
39 Call to deprecated method assertResponse() of class Drupal\Tests\BrowserTestBase.
48 Call to deprecated method assertResponse() of class Drupal\Tests\BrowserTestBase.
54 Call to deprecated method assertResponse() of class Drupal\Tests\BrowserTestBase.
57 Call to deprecated method assertFieldByName() of class Drupal\Tests\BrowserTestBase.
67 Call to deprecated method assertResponse() of class Drupal\Tests\BrowserTestBase.
76 Call to deprecated method assertResponse() of class Drupal\Tests\BrowserTestBase.
82 Call to deprecated method assertResponse() of class Drupal\Tests\BrowserTestBase.
85 Call to deprecated method assertFieldByName() of class Drupal\Tests\BrowserTestBase.
88 Call to deprecated method assertFieldByXPath() of class Drupal\Tests\BrowserTestBase.
102 Call to deprecated method assertResponse() of class Drupal\Tests\BrowserTestBase.
------ ---------------------------------------------------------------------------------------
------ --------------------------------------------------------------------------------------------
Line tests/src/Functional/EntityEmbedEntityBrowserTest.php
------ --------------------------------------------------------------------------------------------
Class Drupal\entity_embed\Tests\EntityEmbedEntityBrowserTest was not found while trying to
analyse it - autoloading is probably not configured properly.
------ --------------------------------------------------------------------------------------------
------ -----------------------------------------------------------------------------------
Line tests/src/Functional/EntityEmbedFilterTest.php
------ -----------------------------------------------------------------------------------
47 Call to deprecated method assertNoRaw() of class Drupal\Tests\BrowserTestBase.
48 Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase.
49 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
50 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
60 Call to deprecated method assertNoRaw() of class Drupal\Tests\BrowserTestBase.
61 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
62 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
69 Call to deprecated method assertNoRaw() of class Drupal\Tests\BrowserTestBase.
70 Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase.
71 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
72 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
85 Call to deprecated method assertNoRaw() of class Drupal\Tests\BrowserTestBase.
86 Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase.
87 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
88 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
89 Call to deprecated method assertCacheTag() of class Drupal\Tests\BrowserTestBase.
99 Call to deprecated method assertNoRaw() of class Drupal\Tests\BrowserTestBase.
100 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
111 Call to deprecated method assertNoRaw() of class Drupal\Tests\BrowserTestBase.
112 Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase.
113 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
114 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
115 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
125 Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase.
126 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
127 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
138 Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase.
139 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
140 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
144 Call to deprecated method assertNoRaw() of class Drupal\Tests\BrowserTestBase.
145 Call to deprecated method assertNoRaw() of class Drupal\Tests\BrowserTestBase.
156 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
157 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
165 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
166 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
180 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
181 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
182 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
185 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
197 Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase.
198 Call to deprecated method assertNoLink() of class Drupal\Tests\BrowserTestBase.
199 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
200 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
201 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
211 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
------ -----------------------------------------------------------------------------------
------ -------------------------------------------------------------------------------------
Line tests/src/Functional/EntityEmbedHooksTest.php
------ -------------------------------------------------------------------------------------
61 Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase.
62 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
64 Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase.
65 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
78 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
81 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
82 Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase.
83 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
84 Call to deprecated method assertLinkByHref() of class Drupal\Tests\BrowserTestBase.
------ -------------------------------------------------------------------------------------
------ --------------------------------------------------------------------------------
Line tests/src/Functional/EntityEmbedTestBase.php
------ --------------------------------------------------------------------------------
124 Call to deprecated method assertEqual() of class Drupal\Tests\BrowserTestBase.
------ --------------------------------------------------------------------------------
------ ---------------------------------------------------------------------------------------
Line tests/src/Functional/EntityEmbedTwigTest.php
------ ---------------------------------------------------------------------------------------
31 Call to deprecated method assertEqual() of class Drupal\Tests\BrowserTestBase.
40 Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase.
44 Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase.
45 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
46 Call to deprecated method assertLinkByHref() of class Drupal\Tests\BrowserTestBase.
50 Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase.
51 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
52 Call to deprecated method assertNoLinkByHref() of class Drupal\Tests\BrowserTestBase.
------ ---------------------------------------------------------------------------------------
------ --------------------------------------------------------------------------------
Line tests/src/Functional/EntityEmbedUpdateHookTest.php
------ --------------------------------------------------------------------------------
43 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
44 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
77 Call to deprecated method assertEqual() of class Drupal\Tests\BrowserTestBase.
------ --------------------------------------------------------------------------------
------ ---------------------------------------------------------------------------------------
Line tests/src/Functional/EntityReferenceFieldFormatterTest.php
------ ---------------------------------------------------------------------------------------
28 Call to deprecated function entity_create().
68 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
77 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
78 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
87 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
88 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
89 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
109 Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase.
110 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
111 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
112 Call to deprecated method assertLinkByHref() of class Drupal\Tests\BrowserTestBase.
122 Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase.
123 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
124 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
125 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
126 Call to deprecated method assertNoLinkByHref() of class Drupal\Tests\BrowserTestBase.
136 Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase.
137 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
------ ---------------------------------------------------------------------------------------
------ -------------------------------------------------------------------------------------
Line tests/src/Functional/FileFieldFormatterTest.php
------ -------------------------------------------------------------------------------------
66 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
67 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
81 Call to deprecated method assertText() of class Drupal\Tests\BrowserTestBase.
82 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
83 Call to deprecated method assertLinkByHref() of class Drupal\Tests\BrowserTestBase.
------ -------------------------------------------------------------------------------------
------ -------------------------------------------------------------------------------------
Line tests/src/Functional/ImageFieldFormatterTest.php
------ -------------------------------------------------------------------------------------
67 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
73 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
74 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
75 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
76 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
77 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
78 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
79 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
80 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
93 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
94 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase.
95 Call to deprecated method assertLinkByHref() of class Drupal\Tests\BrowserTestBase.
------ -------------------------------------------------------------------------------------
------ ------------------------------------------------------------------------------------
Line tests/src/Functional/ViewModeFieldFormatterTest.php
------ ------------------------------------------------------------------------------------
34 Call to deprecated method assertIdentical() of class Drupal\Tests\BrowserTestBase.
52 Call to deprecated method assertRaw() of class Drupal\Tests\BrowserTestBase.
------ ------------------------------------------------------------------------------------
------ ---------------------------------------------------------------------------------------
Line tests/src/FunctionalJavascript/EntityEmbedDialogTest.php
------ ---------------------------------------------------------------------------------------
29 Call to deprecated method assertFieldByName() of class Drupal\Tests\BrowserTestBase.
32 Call to deprecated method assertFieldByXPath() of class Drupal\Tests\BrowserTestBase.
------ ---------------------------------------------------------------------------------------
------ --------------------------------------------------------------------------------
Line tests/src/FunctionalJavascript/EntityEmbedTestBase.php
------ --------------------------------------------------------------------------------
127 Call to deprecated method assertEqual() of class Drupal\Tests\BrowserTestBase.
------ --------------------------------------------------------------------------------
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | entity-embed--drupal-9-deprecation-fixes-3042600-26.patch | 37.17 KB | oknate |
| #26 | 3042600-interdiff--20-26.txt | 14.83 KB | oknate |
Comments
Comment #2
sergiu stici commentedHere is the patch, please review.
Comment #4
sergiu stici commentedCorrected code sniffer, and any errors. Here is the patch. Please review.
Comment #6
wim leersThanks for working on this! 🙏 🥳
It'll be great to get this fixed, but we first need tests to be passing again of course :)
Comment #7
wim leersPart of this has been fixed in #3023051: Stop using deprecated assertIdentical() and assertEqual() functions in tests already.
Comment #8
wim leersComment #9
wim leersComment #10
wim leersClosed #3051101: Drupal 9 Deprecated Code Report as a duplicate of this.
Comment #11
wim leersComment #12
waverate commentedComment #13
wim leersClosed #3052245: Replace deprecated method link() with toLink() as a duplicate.
Comment #14
oknateFirst change:
Comment #15
oknateWorking on this.
Still to do: I need to add back fixes for assertResponse:
Comment #16
oknateThis patch takes drupal-check output down to one error:
Comment #18
oknateFixing some coding standard errors:
I'm not sure why the last test run failed. Investigating.
Comment #20
oknateThe failure was due to this error:
So it seems that changing $entity->link to $entity->toLink is more complex, and might be better handled in a separate issue, because some entities don't have canonical link template, this means toLink and toUrl fail. So for these types of entities, such as files, we have to add custom handling in order to display a link in the dialog.
While touching this, I'm adding _blank as the target on the links. There's no use case where you'd want the EntityEmbedDialog to go away by clicking on a link, when the back button means you have to start over.
I'm moving $entity->toUrl()->toString() into the catch statement, as it throws an error with file entity.
This requires special handling for the file:
Here's all the code to get the entity link to display in the dialog:
Also, I was getting this unrelated error locally, due to incorrect sRGB profile in the image '/js/plugins/drupalentity/entity.png'. I don't know if we need to fix that, but it was annoying me when testing, so I switched out which png I'm using as a test image.
I fixed this by switching out images here:
Comment #21
oknateComment #22
tatarbjComment #23
tatarbjComment #24
oknateBecause I keep stepping on my own toes, I'm creating a meta issue with some of my test updates:
#3055928: [META] 8.x-1.0-beta4 plan
Comment #25
wim leersThanks for pushing this forward!
It didn't fail, it just didn't have a canonical link template.
I think the
elsestatement should contain what is currently in thecatchstatement?Let's use
\Drupal\file\FileInterface::createFileUrl()instead.EDIT: nope, that'd make this module require Drupal 8.7.x, which we don't want.
80 cols formatting: more things fit on the first line.
Are these kinds of changes truly necessary for code deprecation fixes? I don't see it in the issue summary's
drupal-checkoutput. At most, this would be coding standards improvements, which is a separate concern.Reverting these changes would make the patch much simpler.
Everything else looks fine :)
Comment #26
oknateResponses to #25
1), that comment about it failing was already there! I removed it, since I think it's unnecessary. I updated the logic, since we know files don't have a canonical link template, we can prevent the error that triggers the catch, so we can move that into the catch statement, as per your suggestion. We might not need the catch statement, but I'm leaving it for now. We should manually test, as I don't think we have test coverage for all the scenarios here. I just eyeballed the change and haven't tested it yet.
2) There's nothing to be done there.
3) Added more text to the first line.
4) I removed the unrelated stylistic change. I'm refactoring away that code anyway in #3052482: Expand EntityEmbedFilter's test coverage: test many more edge cases, change to kernel test currently anyway.
Comment #27
oknateComment #28
wim leers#26: that all sounds good, thanks!
From 49K patch to 37K, nice.
I didn't manually test this (per #26.1), but I did thoroughly review this and am confident that this continues to work correctly for
Fileentities, based on my testing with a debugger thatreturns FALSE for
Fileentities :)Thanks, @oknate!
Comment #29
wim leersComment #31
wim leers🚢
Comment #33
kristen polPer 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.
Comment #34
vinodhini.e commentedLine src/EntityEmbedDisplay/EntityEmbedDisplayManager.php
------ ---------------------------------------------------------------------------------------------------
32 config:entity_view_mode_list cache tag might be unclear and does not contain the cache key in it.
Facing this issue. Can anyone help me with this?