See #2735005: Convert all Simpletest web tests to BrowserTestBase (or UnitTestBase/KernelTestBase)
Drupal\config\Tests
Skipped tests:
- ConfigInstallProfileUnmetDependenciesTest (Needs
InstallerTestBase) - \Drupal\config\Tests\AssertConfigEntityImportTrait could be moved?
- \Drupal\config\Tests\SchemaCheckTestTrait is deprecated already
Blockers:
#2795085: Add assertNoCacheTag to assertLegacyTrait
#2809471: Convert AJAX part of \Drupal\config\Tests\ConfigEntityTest::testCRUDUI to JavascriptTestBase
A brief history for maintainers, or those wishing to help too by @vaplas:
📌 #8: @andypost created a patch, without going beyond the problem (but with a number of fail places)
📌 #14: @vaplas fixed same fail + added compatibility with Windows (unrelated changes)
📌 #17: @vaplas fixed last fail place + added ConfigEntityTest (because the joy eclipsed him, and he wanted to see all the tests green at once). The patch was unreadable and contained spaghetti from two issues.
📌 #18, #19: @Lendude and @andypost just helped to make it correctly (diff --find-copies).
🎉 Woot! Now we just need to wait while ConfigEntityTest contains js-part. We thought that this would happen quickly, and #21 change status on Postponed, despite the fact that the last patch was spaghetti :)
⏳ But it took some time.
⚔ 23-37: Two new heroes (@jonathan1055 and @Jo Fitzgerald) continue to work with a cold start. Unfortunately, faced with the ConfigEntityTest, they both began to fight with him.
🚩 #28, #35: @Lendude indicates that need a simple port, but in the heat of battle is not understood :)
💡 #27: @jonathan1055 simplifies part of the code, which was approved by dawehner in 39.1.
📌 #38: @vaplas made simple port of ConfigEntityTest.
📌 42: remove unrelated changes for Windows compatibility :)
| Comment | File | Size | Author |
|---|---|---|---|
| #69 | interdiff-patches-61-68.txt | 1.75 KB | Anonymous (not verified) |
| #68 | 2870439-68.patch | 26.36 KB | andypost |
| #61 | interdiff-59-61.txt | 611 bytes | Anonymous (not verified) |
| #61 | 2870439-61.patch | 26.42 KB | Anonymous (not verified) |
Comments
Comment #2
andypostComment #3
dawehnerWhat do we do with all the other files in this directory?
Comment #4
andypostSorry, now the patch that moves all tests except
ConfigInstallProfileUnmetDependenciesTestand 2 traitsComment #5
dawehnerI agree, this test doesn't belong here yet. One of the traits is already deprecated, the other one isn't. We should move it && refer from the old one, just like
\Drupal\config\Tests\SchemaCheckTestTraitis done. Note: We probably want to move it to core/modules/config/tests ...Comment #6
andypostGood idea, but
SchemaCheckTestTraitused in\Drupal\views\Tests\Handler\FilterDateTestPS: also it's used in
\Drupal\page_manager\Tests\PageConfigSchemaTestso needs other issueComment #7
dawehnerNo worries, this is why we have deprecations, don't we?
Please keep in mind: try to make as few changes as possible so the patches are in a reviewable form.
Comment #8
andypostFix few failures, still needs work
Comment #9
dawehnerGood progress!
Comment #11
andypostComment #12
naveenvalechaThis issue is blocked by #2795085: Add assertNoCacheTag to assertLegacyTrait
Comment #13
dawehnerThis is in, yeah!
Comment #14
Anonymous (not verified) commentedSame progress, but still needs work.
#8: agree, #2809471: Convert AJAX part of \Drupal\config\Tests\ConfigEntityTest::testCRUDUI to JavascriptTestBase must really help.
Also few tests not works on Windows:
But maybe this can be fixed later.
Comment #16
Anonymous (not verified) commentedCan anybody reproduce this fail? I have green all tests from ConfigImportUITest. Running tests like:
Comment #17
Anonymous (not verified) commented#16.1: Looks like
rebuildContainer()solved this problem (see interdiff).#16.2: Also I included #2809471-13: Convert AJAX part of \Drupal\config\Tests\ConfigEntityTest::testCRUDUI to JavascriptTestBase patch, hoping to get a green color. But maybe we need postponed current issue, by analogy with #2794347-28: Convert web tests to browser tests for field_ui module.
Comment #18
lendude@vaplas think you missed --find-copies when rolling that patch :) Could you reroll?
Comment #19
andyposthere's reroll
Comment #20
dawehnerShould we wait until #2809471: Convert AJAX part of \Drupal\config\Tests\ConfigEntityTest::testCRUDUI to JavascriptTestBase is in?
Comment #21
Anonymous (not verified) commentedPostponed per #8, #17, #20.
Comment #23
jonathan1055 commented#2809471: Convert AJAX part of \Drupal\config\Tests\ConfigEntityTest::testCRUDUI to JavascriptTestBase is in, so un-postponing.
Comment #24
jonathan1055 commentedIt looks like we have duplicate issues for converting the config tests:
#2864026: Convert web tests to browser tests for config module
Created on 25 March 2017.
It is a child of #2735005: Convert all Simpletest web tests to BrowserTestBase (or UnitTestBase/KernelTestBase) but is not shown on that issue summary.
#2870439: Convert web tests to browser tests for config module (this issue)
Created 17 April 2017.
Also a child of the main issue and is shown in that issue summary. It has a bigger patch with more work done (15 files changed compared to 10).
Comment #25
naveenvalechaClosing this as duplicate in favor of #2864026: Convert web tests to browser tests for config module Thanks for the work here @andypost and @valpas
Comment #26
jonathan1055 commentedThanks naveenvalecha. However, I think it should be the other way round. I have downloaded, tested and compared the two patches, and the work in this issue has progressed further, even though it started later. The work does differ slightly, so we can discuss which bits to use from each, but this is the issue which should remain open, and #2864026: Convert web tests to browser tests for config module should be closed as a duplicate.
The patch in #19 does not apply anymore, so I will upload a re-roll shortly, then we can go from there.
Comment #27
jonathan1055 commentedHere is the patch from #19 re-rolled. It was clear how to correct it for most of the source commits which had happened since July. However, I have some difficulty with
testCRUDin /Functional/ConfigEntityTest.php. Also the filesrc/FunctionalJavascript/ConfigEntityTest.phpnow already exists, so I have temporarily called the new one created in #19/ConfigEntityTestNew.php. This will have to change, and looking at the comments, it might have been copy'n'pasted, because the @group is views_ui. Is that correct?I will provide an interdiff shortly, however, I want to get this patch up and tested on d.o. Two of these tests fail on my localhost but they may run OK here.
Comment #28
lendudeWhat remains of
ConfigEntityTestin HEAD can now just be converted to a normal Functional test, the part that needed Javascript was removed in #2809471: Convert AJAX part of \Drupal\config\Tests\ConfigEntityTest::testCRUDUI to JavascriptTestBase.Comment #29
jofitzCombined FunctionalJavascript/ConfigEntityTestNew.php with Functional/ConfigEntityTest.php.
Comment #31
jofitzAdd missing use statement.
Comment #33
jonathan1055 commentedHi Jo,
Are you sure that this test code is still actually needed? I moved it there as a temporary measure to get the re-roll done, and make sure nothing got accidentally dropped, but see Lendude's comment:
I took the remainder and moved it into a normal functional test, which is already in patch #27. We need to examine the code in detail, but at first glance it looks like all the javascript testing is already in #2809471: Convert AJAX part of \Drupal\config\Tests\ConfigEntityTest::testCRUDUI to JavascriptTestBase which created the new
src/FunctionalJavascript/ConfigEntityTest.php. So maybe we do not need to add anything more to the javascript test?Jonathan
Comment #34
jofitzOh, I thought that was the remaining code to which @Lendude was referring. Perhaps not.
Comment #35
lendudeWhat I meant was that in #27 I would say that we just need to change this to
extends BrowserTestBaseand not JavascriptTestBase. So basically treat ConfigEntityTest like any other test we are converting, since the part that needed javascript has already been removed from the test.Does that make sense?
Comment #36
jonathan1055 commentedYes, and I think I have already done that:
Beneath this, you can see where I removed lots of code from
testCRUDUI(). So possibly the only thing that needs to be done with patch #27 is just delete the creation of file FunctionalJavascript/ConfigEntityTestNew.phpJonathan
Comment #37
jofitzThis was my thought process:
That's how I got to the conclusion I did. Sorry if I got it wrong.
EDIT: Cross-post.
Comment #38
Anonymous (not verified) commentedThanks @jonathan1055 and @Jo Fitzgerald!
I also worked on refactoring ConfigEntityTest in #2809471-19: Convert AJAX part of \Drupal\config\Tests\ConfigEntityTest::testCRUDUI to JavascriptTestBase :) But then after dawehner's advice, we found an easier way of porting js part.
#18, #19: @Lendude, @andypost thanks for hint and hep with make it.
#35: done! The patch is based on #27 + port ConfigEntityTest as is.
Comment #39
dawehner👍 One less workaround we have laying around!
❓These look like unrelated changes ... do you mind clarifying?
Comment #40
jonathan1055 commentedThanks valpas. Your patch is OK in principle, but it does not actually match your interdiff
I had already started the WTB -> BTB conversion for ConfigEntityTest mentioned by Lendude in 35 - see my comment in 36. So what your inderdiff should show is the lines removed/added in
testCRUDUI().You have correctly removed the unwanted new file
FunctionalJavascript/ConfigEntityTestNew.php. Thanks.Comment #41
jonathan1055 commentedHere is the actual interdiff between patches #27 and #38.
Now that we have Valpas here, who worked on #2809471: Convert AJAX part of \Drupal\config\Tests\ConfigEntityTest::testCRUDUI to JavascriptTestBase I am sure we can get this sorted. What you are saying (and the patch in #38 matches this) is that we do not need any of the material changes within the tests in
ConfigEntityTestwe can take it exactly as-is and just do the straight WTB->BTB conversion. In that case patch 38 is good (apart from the review points noted by dawehner in #39)[edit: your comment and interdiff confused me, but your work is good :-) Sorry for my lack of understanding, I have now realised what you meant, and the patch in 38 is right]
Comment #42
Anonymous (not verified) commented#39.1: yep, @jonathan1055 added this in the #27.
#39.2: fair! I added this for compatibility with Windows, and remove these unrelated changes now. Because the problem with incompatibilities between OS is quite common, and we can do it after porting.
#40-41: you caught me!) All your questions are fair, because I really made a mess with description in my last posts. Sorry! Now interdiff is true interdiff :)
A brief history for mantainers, or those wishing to help too:
📌 #8: @andypost created a patch, without going beyond the problem (but with a number of fail places)
📌 #14: @vaplas fixed same fail + added compatibility with Windows (unrelated changes)
📌 #17: @vaplas fixed last fail place + added ConfigEntityTest (because the joy eclipsed him, and he wanted to see all the tests green at once). The patch was unreadable and contained spaghetti from two issues.
📌 #18, #19: @Lendude and @andypost just helped to make it correctly (diff --find-copies).
🎉 Woot! Now we just need to wait while ConfigEntityTest contains js-part. We thought that this would happen quickly, and #21 change status on Postponed, despite the fact that the last patch was spaghetti :)
⏳ But it took some time.
⚔ 23-37: Two new heroes (@jonathan1055 and @Jo Fitzgerald) continue to work with a cold start. Unfortunately, faced with the ConfigEntityTest, they both began to fight with him.
🚩 #28, #35: @Lendude indicates that need a simple port, but in the heat of battle is not understood :)
💡 #27: @jonathan1055 simplifies part of the code, which was approved by dawehner in 39.1.
📌 #38: @vaplas made simple port of ConfigEntityTest.
📌 42: remove unrelated changes for Windows compatibility :)
To be continued?)
Comment #43
jonathan1055 commentedValpas you are a star! What an excellent summing up of the story.
I've compared your patch 42 with 38 and the three sets of changes in ConfigInstallWebTest.php do indeed revert those lines back to unchanged, as dawehner asked for.
Comment #44
Anonymous (not verified) commented@jonathan1055, thank you for double-check and such kind feedback!
I also noticed that @dawehner indicated in 39.2 one more item:
We need this, because the following code gives different results between simpletest and phpunit:
So, we can replace this code on a more semantically understandable, like
But perhaps this is beyond minimal porting, so @andypost made a simplest replacement.
Additional review:
We can do without (string) conversions:
We need rebuildContainer() to update the container variable, after import operations, otherwise the fail in test. (see #15 - #17).
We need resetAll() after install the integration module, otherwise the fail in test.
Hm.. after #2907485: Add getAllOptions() to AssertLegacyTrait we can do without it, but once already done, why revert it to deprecated state?)
Looks like all other changes is a direct code transfer (except #39.1, of course).
Comment #45
lendude@vaplas++++++
added your summary to the IS
I think the only thing left to do is #44.1? Rest looks great to me.
Comment #46
Anonymous (not verified) commentedThanks @Lendude! 44.1 done.
Comment #47
lendudeLooks great now.
So to me the only question remaining is what to do about
AssertConfigEntityImportTrait.The IS says 'move?', I'd say 'copy to new location and deprecate the old one'. It is only used once in core, so it won't inflate this patch too much. Other ideas?
Comment #48
Anonymous (not verified) commentedWhat new place will be best? SchemaCheckTestTrait use core/tests/Drupal/Tests location. But, as you pointed out, the AssertConfigEntityImportTrait is more specific. So I put it in the core/modules/config/tests/src/Traits (simple c/p + update EntityReferenceIntegrationTest).
Comment #49
Anonymous (not verified) commentedOpps, incorrect changes. Ingnore #48 patch, please.
Comment #50
andypostI bet new code should not use deprecated EM
Comment #51
Anonymous (not verified) commentedDone.
Comment #52
lendudeSince it's now used in a BrowserTestBase test, this comment is no longer accurate
And are we sure we want to make the old trait just use the new trait? That way we can't make any changes to the trait that are PHPUnit specific without breaking the trait meant for WebTestBase. I would opt to leave the old trait as is, just deprecated. Yeah it gives some code duplication now, but it means we can do further changes to the new trait without fear of breaking Simpletest tests.
Not sure what is preferable here.
Comment #53
Anonymous (not verified) commented#52: it is logical, thanks @Lendude! Back to #46 and try again). So, now #50 applied only to phpunit version.
Comment #55
jonathan1055 commentedHi valpas,
In patch #53 was the failure due to not making the change in
Functional/EntityReference/EntityReferenceIntegrationTest.phpas was done in patch #51 ?Hence the test produced the deprecation message and failed exactly as we would want, when using deprecated code ;-)
Comment #56
jonathan1055 commentedWe also need a Change Record for the deprecation, which I have just created. I set the "introduced in version" to 8.4.1 given than 8.4.0 is now released.
https://www.drupal.org/node/2916197
Comment #57
Anonymous (not verified) commented@jonathan1055, thank you for clarifying and CR!
Did I understand correctly that we need to update the
EntityReferenceIntegrationTest(done), or should we not add atrigger_errorto simpletestAssertConfigEntityImportTrait?I also overlooked #52.1. Done.
Comment #58
jonathan1055 commentedYes, you did the correct option. The test needs to use the new trait, and the deprecation trigger_error should stay, so that any other newly created tests produce an error if they start using it.
You can now also add the CR url into the @trigger_error message and the @deprecated tag, as per https://www.drupal.org/core/deprecation
Comment #59
Anonymous (not verified) commentedIndeed! + change 8.4.x on 8.4.1, I hope this is really quite plausible version ;)
Comment #60
jonathan1055 commentedLooking good. One minor point - you missed the id in the docblock url
Don't re-roll the patch yet, as others may spot something else ;-)
Comment #61
Anonymous (not verified) commented@jonathan1055, thanks again! Catches from others can not stop re-roll after good catch from you ;)
Comment #62
lendudeLooks great now!
Comment #63
alexpottAdding credit for @dawehner and @Lendude for patch reviews.
Comment #65
alexpottAdding credit to @GoZ for working on the duplicate issue #2864026: Convert web tests to browser tests for config module
Comment #66
alexpottCommitted 093b148 and pushed to 8.5.x. Thanks!
We need a quick patch for 8.4.x because there are conflicts in ConfigEntityListTest due to #2767857: Add destination to edit, delete, enable, disable links in entity list builders.
Comment #68
andypostQuick re-roll for 8.4.x
Comment #69
Anonymous (not verified) commented🎉🎉🎉
#68: I can confirm, that it is re-roll, and it is very quick!
Comment #70
alexpottCommitted 75273e5 and pushed to 8.4.x. Thanks!
Thanks for the super quick-reroll @andypost. And @vaplas that diff is helpful. It's great to be able to keep the branches in-sync for tests.
Comment #72
jonathan1055 commentedThanks alexpott and everyone. Good team effort.
The change record I created is still in draft. Should that be published now? https://www.drupal.org/node/2916197
Comment #73
jonathan1055 commentedInteresting that the "View all draft change records" link is actually wrong. That url https://www.drupal.org/list-changes/drafts tries to display all change records for the "draft" project. It should actually be https://www.drupal.org/list-changes/drupal/drafts
Comment #74
andypostCR published
@jonathan1055 follow the issue #2151041-92: Add a "draft" status for change records
Comment #75
jonathan1055 commentedThanks andypost for raising it on that issue, which I have now followed.