Problem/Motivation
(From #1659682: Consider renaming randomString() and/or adding additional, context-appropriate helpers for random string generation; see also #1672764: Improve documentation of randomString() and randomName())
DrupalTestBase::randomName()
andUnitTestCase::randomName()
does not entirely clarify the function's purpose: to generate a random machine name, for use generating already-validated machine names.
Proposed resolution
- Rename
randomName()
torandomMachineName()
.
Remaining tasks
- Review.
- #1659682: Consider renaming randomString() and/or adding additional, context-appropriate helpers for random string generation discusses renaming
randomString()
and/or adding other, more specific helpers. A single change notice could probably be shared between multiple issues.Change record: https://www.drupal.org/node/2315865
API changes
DrupalTestBase::randomName()
is renamed torandomMachineName()
.UnitTestCase::randomName()
is renamed torandomMachineName()
.
Comment | File | Size | Author |
---|---|---|---|
#19 | 1676910-randomMachineName-19.patch | 673.26 KB | penyaskito |
#17 | drupal-rename_randomName-1676910-17.patch | 674.71 KB | l0ke |
Comments
Comment #1
jhodgdonI don't think this is quite a documentation issue. :)
Comment #1.0
jhodgdonUpdated issue summary.
Comment #2
penyaskitoIs it too late for this to land on D8?
Comment #3
penyaskitoComment #4
cs_shadow CreditAttribution: cs_shadow commentedApart from
DrupalTestBase::randomName()
, there's also aUnitTestCase::randomName()
. Does this issue implies to change both or just the first one (that's if its not too late). Someone please clarify.Comment #5
dawehnerYou are 100% right, we should sync those 2 code snippets.
Comment #6
cs_shadow CreditAttribution: cs_shadow commentedAttaching a patch where I replaced every occurrence of
randomName
torandomMachineName
. Hope it doesn't breaks anything.Comment #8
cs_shadow CreditAttribution: cs_shadow commentedSorry, patch in #6 was not against latest HEAD.
Comment #10
cs_shadow CreditAttribution: cs_shadow commentedThis one should work.
Comment #11
cs_shadow CreditAttribution: cs_shadow commentedComment #12
penyaskitoDoesn't apply anymore.
Comment #13
penyaskitoComment #14
cs_shadow CreditAttribution: cs_shadow commentedQuick reroll.
Comment #15
penyaskitoI guess we will need a change record draft.
Comment #17
l0keReroll against latest HEAD.
Comment #18
penyaskitoDoes not apply anymore.
Comment #19
penyaskitoUsed rename with phpstorm.
Comment #20
penyaskitoComment #21
penyaskitoCreated draft change notice: https://www.drupal.org/node/2315865
Comment #22
penyaskitoComment #23
cs_shadow CreditAttribution: cs_shadow commentedTweaked the Change Recoed a bit.
Comment #24
alexpottCommitted 9eac446 and pushed to 8.0.x. Thanks!
Comment #26
m1r1k CreditAttribution: m1r1k commented