Closed (fixed)
Project:
Drupal core
Version:
8.4.x-dev
Component:
shortcut.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
26 Mar 2017 at 08:26 UTC
Updated:
28 Sep 2017 at 00:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
goz commentedComment #3
dawehnerThis for me sounds like something we maybe should put into a trait. Any thoughts about that?
Comment #4
goz commentedMay be i should move it into a new AssertBlockTrait. Are you ok with that or you thought about another place ?
Comment #5
dawehner+1 from me, but please consult others. I personally believe the
\Drupal\simpletest\BlockCreationTraitshould be merged with those assertions, as you kinda need both for it to be userful.Comment #6
jibran+1 form me too.
Comment #7
goz commentedIn any cases, this issue should not move BlockCreationTrait. We should create a new issue to do this.
So we can:
1/ Add assertions to BlockCreationTrait and then move it in a new issue to avoid conflict with other wtb to btb conversions issues.
2/ Add assertions to AssertBlockTrait and then merge BlockCreationTrait in AssertBlockTrait in a new issue.
any thoughts ?
Comment #8
jibranAgreed.
Comment #9
dawehnerCan we point to some change notice?
Comment #10
dawehnerComment #11
michielnugter commentedThese methods are added in this issue #2865336: Add \Drupal\simpletest\WebTestBase::assertBlockAppears to \Drupal\FunctionalTests\AssertLegacyTrait.
Shall we postpone on that one and add the methods there?
Comment #12
michielnugter commentedComment #13
michielnugter commentedComment #14
naveenvalechaIs there any way to proceed this? Shall we convert the test which requires #2865336: Add \Drupal\simpletest\WebTestBase::assertBlockAppears to \Drupal\FunctionalTests\AssertLegacyTrait in the followup? otherwise, we'll have to wait for long on long chains of blocking issues? Thoughts?
//Naveen
Comment #15
lendude@naveenvalecha it's only postponed on one issue, that just needs tests, so I think leaving it postponed on that and lets see if we can move #2865336: Add \Drupal\simpletest\WebTestBase::assertBlockAppears to \Drupal\FunctionalTests\AssertLegacyTrait forward, because I think more conversions are blocked on that
Comment #17
jonathan1055 commentedThe patch in #2 does not apply any more in 8.5.x and 8.4.x so here is a straight re-roll.
However, things have moved on since the discussions above regarding in which Trait to put methods
assertBlockAppearsandassertNoBlockAppears. The issue #2863644: Convert web tests of block now adds these methods to a new filemodules/block/tests/src/Functional/AssertBlockAppearsTrait.phpwhich can be used by the Shortcut tests. That issue is RTBC so it should be not be too long before it is committed. I will create a new patch with the changes required inshortcutLinksTeststo use that Trait.Comment #18
jonathan1055 commentedSo, here's a patch which uses
AssertBlockAppearsTrait.phpinstead of adding the methods totests/Drupal/FunctionalTests/AssertLegacyTrait.php. To show that this will pass, I have created the new Block file here in this patch, however, when #2863644: Convert web tests of block lands we will not need to do this, and that bit can be deleted from the patch.Comment #19
lendude\Drupal\shortcut\Tests\ShortcutTestBasegets moved in the patch. This should not be moved but copied to the new location.The WebTestBase version should be @deprecated, a trigger_error() should be set, and we need a Change record for the deprecation. We usually treat base classes as API in these conversions.
Comment #20
jonathan1055 commentedI just re-rolled the patch, but yes I guess it should be deprecated. Although there are no remaining tests in the old
shortcut/src/Testsfolder so would anyone really think to create some new WebTestBase test files after these have been removed?Anyway, I have created a change record https://www.drupal.org/node/2906736 (based on the one for Block module) and made the change so that the base file remains in place, with a deprecation trigger_error.
No changes to the five files from patch #18. New patch attached (with the same note as before, the new AssertBlockAppearsTrait.php file is only to allow testing on d.o. to pass).
Comment #21
lendude@jonathan1055 thanks for the update, looks good, CR looks good too.
It's about BC, somebody might be using this in contrib. If somebody has a shortcut extending module and has tests, they might be using the base class to build their tests on, and removing the base class would break BC (I'm not saying this is likely here, but for bigger modules like Node and Views this becomes much more likely and IMO it's best to just have a clear policy on this and just use the same deprecation pattern for all conversions).
NB. As a patch-size-shrinker try using
git diff --find-copieswhen you deal with patches that contain these base class copies, makes the patch a little easier to readComment #22
jonathan1055 commentedYes of course, I see now, other contrib modules may be extending Shortcut.
Thanks for the hint about
git diff --find-copies. That is really good, so here's a smaller much-more-readable patch using it :-)Comment #23
larowlanblocker is in
Comment #24
dawehnerComment #25
naveenvalechaHere's the straight reroll of the patch with git 3-way merge after #2863644: Convert web tests of block
Also updated IS
Comment #26
lendudeLooks great, test bot happy, we happy.
Thanks all!
Comment #27
jonathan1055 commentedYes, I confirm that the patch in #25 is identical to #22 except it does not add the new file AssertBlockAppearsTrait.php. All looks good.
Comment #30
larowlanCommitted as a739c21 and pushed to 8.5.x.
Cherry-picked as bd28530 and pushed to 8.4.x.
Published change record
Comment #31
jibranThanks, everyone.