Closed (fixed)
Project:
Drupal core
Version:
8.7.x-dev
Component:
database system
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
1 Feb 2017 at 19:46 UTC
Updated:
14 Sep 2018 at 13:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jaykandariComment #3
jaykandariComment #4
jaykandariComment #5
gaurav.kapoor commented#4 solves the problem.Thanks
Comment #6
cilefen commentedThe meta issue reads: "...replace all usages of the function (except tests for the function itself)...". GarbageCollectionTest calls it.
Comment #7
xjmComment #8
daffie commentedThis patch is originally written by @Pavan_B_S in #2856714-4: Replace all calls to db_merge, which is deprecated. So please give him credit for it.
Comment #9
daffie commentedI have reviewed the patch from @Pavan_B_S in #2856714-5: Replace all calls to db_merge, which is deprecated and I came to the following conclusion:
Comment #10
daffie commentedAlmost forgot: @chiranjeeb2410 created an interdiff.txt file for a patch. So he should also get a credit.
Comment #13
xjmComment #14
xjmThanks everyone for working on this!
So, this and other calls in
MergeTestare the tests fordb_merge(), which does not actually exactly wrap the same service. That would be beyond the scope of not removing the self-tests. If it were a thin wrapper that would be one thing, but not much is testing the$optionsparameter, which is set to a different default in the procedural function:I'm not sure how to handle that.
Comment #15
xjmI think if this patch were completing the scope defined on the issue, it would not change the merge tests.
Here is the code related to the target in
getConnection():So it could be that the hunk in
db_merge()is just redundant anyway.The question is whether we should remove all test coverage for
db_merge(). I'm hesitant about that, so we could remove theMergeTestchanges from this patch and discuss how to handle the testing in a followup. I don't think the correct way forConnection::merge()to be tested would be getting the service from the container so the followup should check whether it already has separate tests. We can and still should remove the others in this patch, though.Thanks!
Comment #16
hgunicamp commentedI have fixed the 'db_merge-2848952-8.patch' patch because it was not applying any more because 'array()' notation has already been applied in the files affected by the patch.
Comment #17
cilefen commentedThank you for the continued work everyone.
I think we need to inject the dependency.
Comment #18
jeetendrakumar commentedAs per comment #17 updated patch file.
Comment #19
tstoecklerLooks very nice, thanks!
I found one nitpick:
Trailing whitespace.
Comment #20
jeetendrakumar commentedPlease find updated patch file.
Comment #21
cilefen commented@jeetendrakumar Would you please post the interdiff on #20?
Comment #22
jeetendrakumar commentedinterdiff on #20
Comment #23
pk188 commentedI applied the patch in #22. It applied cleanly and changes all the occurences.
Comment #24
cilefen commentedThank you for working on this everyone! I have some notes and suggestions for getting this one finished:
Sorry for the confusion.
Comment #25
pk188 commentedFixed #24.
Comment #27
borisson_This doesn't belong in the search.module component, I think database system is a better match.
The patch does apply, and it replaces all the calls to db_merge - the only remaining place where I can find it is in database.inc after applying the patch.
Comment #28
xjmMy review in #14 is still not addressed. We also still need the followup in #24.
Thanks!
Comment #29
xjmComment #31
andypostFiled postponed follow-up for #14-#24 #2947769: Inject services after replacing all calls for db_merge()
Also
db_merge()should trigger error like #2820179-18: Replace usages of deprecated method db_change_field(), working on itComment #32
andypostPatch
- moves database connection service retrieval out of loops
- adds triggering deprecated error
- adds test for deprecated error
- adds todos to filed issues
Filed second follow-up for #14.2 #2947775: Move setting default target out of db_merge() and other deprecated db_* functions
Comment #33
andypostAccording #2820179-18: Replace usages of deprecated method db_change_field() test class should be annotated as
@group legacyComment #35
andypostannotation per method is a way
Comment #37
volegerAddressing #14.1 - we should not make any changes in the self-tests as it defined in the parent issue.
Comment #39
volegerAdded expectedDeprecation for the legacy test.
Comment #40
volegerComment #42
volegerOops. My bad
Comment #44
piggito commentedIt seems like @voleger mixed up patch with changes for issue 2848817
I added expectedDeprecation annotation for legacy test using patch in #37 as baseline since this was the last not-mixed patch.
Comment #45
volegerAdded the possibility to reuse added database connection in further db_* function replacements.
Comment #46
volegermissed one replacement
Comment #48
andypostWhy not move this to DatabaseLegacyTest.php and replace usage in MergeTest.php
Comment #49
andypostpatch does not apply
Comment #50
shashikant_chauhan commentedRerolled the patch.
Comment #51
andypostComment #52
mondrakeNW to address #48. Working on it.
Comment #53
mondrakeAddressed #48, injected the db connection in
ShortcutSetStorage.This should be more or less ready -
GarbageCollectionTestwas usingDatabase::getConnection()already; if that needs to be changed it will be done by a follow up of #2991337: Document the recommended ways to obtain the database connection object.Comment #54
mondrakeSorry wrong interdiff in #53, this should be ok.
Comment #56
mondrake$this->assertSameis strict on type.Comment #57
volegerLooks good
Comment #60
catchCommitted 44b3b41 and pushed to 8.7.x. Thanks!
Comment #61
andypostI'm sure it needs follow-up to change test to "instanceOf" assertion because we must test that this function returns declared object - but instead it tests that object works!
For that purpose we have DB api tests)
Comment #62
mondrake#61: umm... how about to have both assertInstanceOf and the result of the operation? I think here it is not bad for contrib drivers to go through the actual operation.
Comment #63
andypostContrib db drivers has own testing for driver classes anyway, so IMO no reason to test what driver class does cos it's it totally different test
Comment #64
mondrakeOpened follow up: #2994955: Followup to #2848952 - fix DatabaseLegacyTest::testDbMerge