Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
We want to convert MiscUnitTest to phpunit.
Proposed resolution
Move drupal_check_memory_limit and parse_size to components
Remaining tasks
Commit
User interface changes
No
API changes
drupal_check_memory_limit
and parse_size
become deprecated, DRUPAL_KILOBYTE
constant moves to the Bytes
component
Original report by @jhedstrom
Task to convert
Bootstrap/GetFilenameUnitTest.php
Bootstrap/OverrideServerVariablesUnitTest.php
Bootstrap/MiscUnitTest.php
Bootstrap/ResettableStaticUnitTest.php
to phpunit.
See #1938068: Convert UnitTestBase to PHPUnit.
Note, #79-#107 was working out how to do a reroll and can be skipped if someone is reading the comments to find out about this issue.
(But #107 has good notes on how to resolve conflicts while doing a re-roll, if someone wants to read about that.)
Comment | File | Size | Author |
---|---|---|---|
#151 | interdiff.txt | 1.04 KB | ParisLiakos |
#151 | bytes.memory.151.patch | 23.42 KB | ParisLiakos |
#148 | interdiff.txt | 1.33 KB | ParisLiakos |
#148 | bytes.memory.147.patch | 23.33 KB | ParisLiakos |
#145 | interdiff.txt | 4.38 KB | ParisLiakos |
Comments
Comment #1
jhedstromThis patch has some duplicated (and not really desirable) overlap with #2003568: Convert tags,attributes, diff and url validation unit tests to phpunit since it is testing functions in bootstrap.inc.
Comment #3
ParisLiakos CreditAttribution: ParisLiakos commentedwhich are the functions called? we should convert them prior to switching test to phpunit
Comment #4
jhedstromLeaving at needs work. I moved a few of the procedural functions to methods in a Bootstrap component, but stopped at the
drupal_static()
function, which I'm sure will require more discussion about how to proceed.Comment #5
jhedstromForgot to add new file.
Comment #6
jhedstromDo folks think it would be feasible to convert
drupal_static()
to a component? If so, I think this issue could proceed.Comment #7
ParisLiakos CreditAttribution: ParisLiakos commenteddrupal_static makes no sense being a component. its only useful in procedural code.
class should use their properties instead
Comment #8
jhedstromThat's what I thought. This patch moves a few more bootstrap functions over to the Bootstrap component, and doesn't try to convert the drupal static unit test.
Comment #10
ParisLiakos CreditAttribution: ParisLiakos commentedi am not sure parse_size() fits into the bootstrap class.
maybe a Bytes component?
Comment #11
jhedstrom#8: system-bootstrap-phpunit-2003800-08.patch queued for re-testing.
Comment #13
jhedstrom#8: system-bootstrap-phpunit-2003800-08.patch queued for re-testing.
Comment #15
jhedstromThis patch creates a Bytes component (under Utility), and also cleans up
DRUPAL_KILOBYTE
references.Comment #17
jhedstromThis adds visibility/static declaration to the 2 methods that caused failures in #15.
Comment #18
dawehnerNitpicking: This should have a starting "\"
Should be "Contains \..."
Let's document being a string/int
"Contains \"
should be string.
that is a bool
It seems to be that we should at least have a new todo which tells that $_SERVER should be entirely replaced by a symfony request object.
Contains
it seems to make more sense to be on a single BootstrapTest test? At least this should be a public method.
Comment #20
jhedstromThis should address all of #18.
Comment #22
jhedstromThese are legitimate fails--digging into why now.
Comment #23
jhedstromI hadn't completed to conversion the the
Bytes
component.Comment #24
jhedstromThis patch replaces remaining calls to
parse_size()
withBytes::parseSize()
.Comment #25
ParisLiakos CreditAttribution: ParisLiakos commentedyay, this makes a lot more sense being here:)
@param array
file is moved so this should changed right? it should also be Contains \..
Actually what you think about just moving the whole thing to BootstrapTest, since they are testing the same class?
lets add public visibility, since we are here
Comment #26
jhedstromProbably too late to get this in for 8.x?
Patch should address #25.
Comment #27
dawehnerJust some small bits.
As we still have the old methods this seriously does not change the API.
Couldn't this also be using a dataprovider, as it just calls the same methods all the time.
Should be @return array
Comment #28
ParisLiakos CreditAttribution: ParisLiakos commentedan additional nit:
needs visibility
And yeah the API does not change here, since we keep the procedural functions, so there shouldnt be a problem
Comment #29
jhedstromThis should address #27 and #28.
Comment #30
dawehnerGreat!
Comment #31
alexpottConsidering we're changing very low level Drupal and code that runs on every request I think we should be profiling this change...
Comment #32
RobLoachTagtastic.... What else will be part of the Bootstrap class? Do we have some follow ups?
I don't think this actually really needs profiling as it's pretty much just moving the function calls to a class. But profiling never hurts! Thanks a lot, guys. This looks great.
Comment #33
Mile23Not sure about the status of this idea, but the patch doesn't apply currently.
Comment #34
damiankloip CreditAttribution: damiankloip commentedRerolled, what else do we need to do here? I think I agree that this doesn't need profiling, but don't mind.
Comment #35
damiankloip CreditAttribution: damiankloip commented.
Comment #36
RobLoachLooks pretty good to me. If we introduce a nice issue summary, I'd vote this pretty much RTBC.
Comment #37
ParisLiakos CreditAttribution: ParisLiakos commentedi think it allso needs profiling.
also a reroll:/
Comment #38
jhedstromRe-rolling.
Comment #40
jhedstromOops, typo.
Comment #41
RobLoachBack to RTBC.
Comment #42
alexpottPatch no longer applies.
Comment #43
jhedstromRe-rolled.
Comment #45
jhedstromRe-roll again. FileItem appears to be changing quite fast.
Comment #46
Mile23Applies and passes. RTBC other than missing @groups.
Comment #47
damiankloip CreditAttribution: damiankloip commentedJust on the new PHPUnit test class.
Comment #48
dawehnerSadly this issue is still tagged as needs profiling.
Comment #49
Mile23Woot groups!
The reason you need the tests is so you can have a behavioral baseline for when you make it go faster.
Comment #50
alexpottPatch no longer applies.
Comment #51
damiankloip CreditAttribution: damiankloip commentedrerolled.
Comment #52
jibranBack to RTBC.
Comment #53
alexpottPatch no longer applies.
Comment #54
amateescu CreditAttribution: amateescu commentedRerolled.
Comment #55
catchCould we check whether this triggers the raw composer autoloader before the APC loader is available? Apart from that I don't think this needs profiling but it'd be good to check that.
Comment #56
Mile23The patch doesn't change
drupal_classloader()
so whatever behavior is there will be preserved. Far as I can tell.Comment #57
Xano54: 2003800-54.patch queued for re-testing.
Comment #58
jhedstromComment #59
LinL CreditAttribution: LinL commentedRerolled, patch no longer applied.
Comment #60
dawehnerWe use "int", "string", and "bool" instead.
You need to rerole that for #1998638: Replace almost all remaining superglobals ($_GET, $_POST, etc.) with Symfony Request object
All those unit tests are such great to look at. Let's use an empty line here and one {@inheritdoc}
Comment #61
jhedstromReroll, and also should address feedback from #60.
Comment #63
jhedstromAgain, reroll from top of 8.x, plus re-factored to inject the
Request
object.Comment #65
jhedstromHadn't saved
bootstrap.inc
in the last patch.Comment #67
jhedstromFixing another typo in
bootstrap.inc
.Comment #68
steeloctopus CreditAttribution: steeloctopus commentedReroll - I tested the patch but unfortunately the one on the PHPUnit test failed.
The BootstrapTest->testCheckMemoryLimit() fails searching for Bytes.php file.
This is because the patch applies the Bytes.php file was applied to the wrong location of the core. Patch applies the Bytes.php to Drupal/Tests/Component/Utility instead of Drupal/Component/Utility
Comment #69
steeloctopus CreditAttribution: steeloctopus commentedComment #71
tim.plunkettGuessing this shouldn't be here :)
This should be Utility\Bytes, not Bytes\Bytes
Comment #72
steeloctopus CreditAttribution: steeloctopus commentedComment #73
steeloctopus CreditAttribution: steeloctopus commentedComment #74
steeloctopus CreditAttribution: steeloctopus commentedI have done a re-roll on this issues and found no errors.
Comment #75
steeloctopus CreditAttribution: steeloctopus commentedComment #76
steeloctopus CreditAttribution: steeloctopus commentedComment #77
YesCT CreditAttribution: YesCT commentedTrying to sort out the status here, so did some interdiffs. and a txt file showing the commands I did to make them. (there are lots of ways to do it, just showing one)
uploading 74 again, to get the bot to run on it.
I haven't done a full review of the reroll to see if it's right..
looks like the reroll emptied files, then 74 removed the emptied files. ok.
72 had Bytes.php not in the place it was in 67, so 74 moved it back to the right spot. ok.
67 had done the things i see in the interdiff of 72 and 74: removing docs on a deprecated function, and changing drupal_check_memory_limit. so that is ok for the reroll, cause we want to get a patch that is doing what 67 was. And then we want to review it. ...
but noting here, before I forget: that 67 probably should not have removed the docs, it should have just added the deprecated doc. but also, there is a discussion about deprecating... in #2158871: [Policy, no patch] Clearly denote when @deprecated code is slated to be removed Could use another opinion on that, but this might be needs work to put the docs back in, and maybe some other things.
Comment #79
YesCT CreditAttribution: YesCT commentedso. I went to look at the 74 I reuploaded, and it looked like it still had the wrong doc for Bytes.php, this really confused me, cause it was right in the file... then I realized that the .diff for 74 had a history of commits.
This one is made with just a
git diff 8.x
talked with @steeloctopus and they didn't have more work to post at this time, so un assigning. No worries.
Comment #80
znerol CreditAttribution: znerol commentedPatch does not apply anymore to head. First needs a reroll and after that I suggest exploring the following options:
Bootstrap
utility component, consider extractingdrupal_override_server_variables
to aCli
orScript
utility component. Later on we could movedrupal_is_cli
and probably other script-related functions over there.Bytes
utility component, consider extractingdrupal_check_memory_limit
andparse_size
into aMemory
utility component.When rerolling, please do not incorporate additional changes. And also when making changes supply a proper interdiff. Otherwise it can get tedious to keep up with the development of a patch. Thank you @YesCT for puzzling together the pieces.
Comment #81
miraj9093 CreditAttribution: miraj9093 commentedComment #82
miraj9093 CreditAttribution: miraj9093 commentedNot able to work on reroll.. patch not applying...
Comment #83
znerol CreditAttribution: znerol commentedWell, we need a reroll because the patch is not applying anymore. A comprehensive guide on how to reroll patches and resolve merge conflicts is available here.
Comment #84
filijonka CreditAttribution: filijonka commentedwill take a shot on this and thanks @znerol for the link
Comment #85
filijonka CreditAttribution: filijonka commentedhere's the reroll. hopefully it works as planned.
Comment #86
znerol CreditAttribution: znerol commenteduse Drupal\Component\Utility\Url
inbootsrap.inc
looks suspicious. Probably it this was not intended.drupal_override_server_variables()
andOverrideServerVariablesUnitTest
was removed in the meantime (see #2213643: Remove dysfunctional drupal_override_server_variables()).parse_size
incolor_scheme_form_submit
withBytes::parseSize
Comment #87
filijonka CreditAttribution: filijonka commenteda new reroll baseed on #79 and help from @YesCT
Comment #88
znerol CreditAttribution: znerol commentedThe reroll looks great so far. Comparing to #79 I see two unrelated changes which makes it more difficult to actually diff the patches:
Do not change unrelated code, it makes diffing more difficult. Those two newlines are not there in
HEAD
.Same here.
Comment #89
filijonka CreditAttribution: filijonka commentedsorry @znerol discovered that after ul the patch but didn't have time to get here and tell you that.
Comment #90
znerol CreditAttribution: znerol commentedBe careful with hand-editing patches :) I bet this will not apply (there is now a hunk without any changes in
color_scheme_form_submit
). While rereading I also noted thatBootstrap::overrideServerVariables
can be removed from the patch (see #2213643: Remove dysfunctional drupal_override_server_variables()).Comment #92
filijonka CreditAttribution: filijonka commentedremoved
Comment #93
filijonka CreditAttribution: filijonka commentedabout the Bootstrap::overrideServerVariables, haven't removed it yet, I guess that would be in boostrap module but is that really a part of this issue? Shouldn't there be a new issue for that?
Comment #94
filijonka CreditAttribution: filijonka commentedThis one will need to have another reroll.
Comment #95
filijonka CreditAttribution: filijonka commented93: system-bootstrap-phpunit-2003800-92.patch queued for re-testing.
just making sure it needs a reroll
Comment #97
filijonka CreditAttribution: filijonka commentedok so made a reroll based on patch in #93.
I never got an reply from znerol about the overrideServerVariables but I went along and removed it and also its tests.
Comment #98
filijonka CreditAttribution: filijonka commentedComment #99
znerol CreditAttribution: znerol commentedSorry for the silence. The removal
overrideServerVariables
from the patch is certainly correct, this code simply does not exist anymore in Drupal 8. The reroll looks almost perfect. I've noticed the following things while comparing #97 to #79:This looks like an accidental change.
This looks unrelated too.
I'm not sure whether we have coding standards about the order of use statements. That said, I'd suggest not moving existing lines around if there is no good reason to do so.
Comment #100
neclimdulI wouldn't view these methods as "Bootstrap." They exist in bootstrap.inc not because they are explicitly part of the bootstrap but because they where needed during the bootstrap process. Once they move to classes they can be loaded at anytime. As such I would do 2 things.
1) Look at the naming again
2) Not name the test "bootstrap" a build individual tests for the classes you are testing.
Comment #101
znerol CreditAttribution: znerol commented@neclimdul: I fully agree, see #80. The renaming should be based on a proper reroll, though.
Comment #102
filijonka CreditAttribution: filijonka commentedHi
comments on #99
1. I'm a bit surprised cause the throw exception was something I had removed I though in #93 which it obviously weren't.
2. I wasn't sure so wanted feedback, thanks it should be removed now (when next patch is coming)
3. I was adviced to do so but I did read through the coding standards doc and couldn't find anything about so I kept it as is.
Since there were stuff already wrong in patch #88 that were still in latest patch I simply rerolled this based on #79 instead and hopefully I got it correct this time.
The removal of functions as discussed isn't removed in this due to that it doesn't seems to be totally clear on what to do based on comment #100 and #101.
Comment #103
sunOy. This issue should be split into multiple. The current patch touches tons of functional code. Those changes are completely unrelated to tests.
Comment #104
filijonka CreditAttribution: filijonka commentedI'm just going to make sure that the patch is rerolled correctly and not anything more. #102 is very wrong so just ignore that one..
Comment #105
filijonka CreditAttribution: filijonka commentedComment #106
filijonka CreditAttribution: filijonka commentedreroll based on #79
bootstrap.inc: use statement think there are about 11 to many now..
The Boostrap.php file with overrideServervariables and checkmemory isn't removed here..just wanted to make sure first to get a clean reroll. When we get that we can begin to remove or not in next patch or new issue..but first a clean reroll which I'm hopefully closer to now.
Comment #107
YesCT CreditAttribution: YesCT commentedI'm rerolling 79 also so we can compare. I'll take notes while I do this. Please read them and ask questions if there is something about resolving conflicts that is confusing.
----------------------------
conflict 1
core/modules/file/lib/Drupal/file/Plugin/Field/FieldType/FileItem.php
when looking at the *patch*
can see that the only thing this patch was doing is adding Bytes.
use Drupal\Core\Field\FieldDefinitionInterface; is a context line in the patch, the patch was not adding it, so we do not add it.
So we keep the new stuff in head, and re-do what the patch was trying to do.
We can put Bytes in alpha order without reordering any other use statements.
conflict resolved by:
------------------------------------------------------
conflict 2
core/modules/color/color.module
looking at the patch:
the patch was just adding the use for Bytes
so we just do that, head has in it Utility/String, so we should leave that there and just add Bytes. (here we cannot insert in alpha order, so just do the best we can and dont worry about it)
I resolved it like:
before moving on to another file, check if there are other conflicts in this file, there are.
-----------------------------------------------
conflict 3
core/modules/color/color.module
this looks like a big difference, but when checking the patch:
we see the only thing it was doing was changing the like with parse_size. the large "conflict" is because some other issue added an if and indented the code in the if. no big deal.
So we keep what is in head, and just redo that change.
which makes it resolved like:
-------------------------------------
conflict 4
core/includes/common.inc
patch was:
so, since #79, some other issue added the @file doc block and changed the use's, and some other issue put in Crypt. fine.
this patch was just adding Bytes and Crypt. Crypt is already added, so keeping head and adding Bytes is all we do.
resolved like:
check for other conflicts in this file.. none. moving on.
-----------------------------------
conflict 5
core/includes/bootstrap.inc
patch was
just adding UrlValidator and Bootstrap.
the Url was just a context line in the patch that confused git.
so resolved like:
check for more conflicts.. yep.
--------------------------------------
conflict 6
core/includes/bootstrap.inc
patch was taking out some docs from drupal_override_server_variables()
but that function is not in head anymore.
so git put back the context lines, and took out the lines it though it should. we should not put them back.
And the patch was not touching the Exception line there, so we should not change that in head either.
See can find if those docs got moved somewhere...
git log -S "Sets appropriate server variables needed for" core/includes
#2213643: Remove dysfunctional drupal_override_server_variables()
Read that patch. The lines are removed, not moved.
so, we know it wasn't moved, it was removed. And that part of our patch has nothing to change, since that function is gone.
so resolved by *just* keeping what is in head and nothing from this hunk.
no more conflicts in this file, and no more conflicts from the rebase,
so added the changes and did a rebase --continue, and made a new patch based on git diff 8.x
=============
I did a diff of patch 106 against this 107.
only real difference was patch in 106 did:
Which is good. We mostly agreed on how to resolve the conflicts. :)
-----------------------------
so I think we should use this 107 as the reroll.
=========================
Now, there is some valid feedback that this approach may not be the correct one.
I think we should as quick as possible, really look at this and see what needs to be done.
Comment #108
filijonka CreditAttribution: filijonka commentedHi
sorry for making this a tremendous idiotic issue but as I said to znerol I did this to learn and whenever anyone felt we needed to get going it was just to override me and so it's done :)
As you may understand I have done this several times without ul to see what happends and the only thing that do confuses me is this line that actually differs 106 and 107. Simpy because and one try it's not there and next one there is. very confusing.
Well next time I need to reroll it will most likely be quicker.
Comment #109
YesCT CreditAttribution: YesCT commented@filijonka Yes. I think there is a lot to learn about rerolling and conflicts, but I think you have got it now. :)
Comment #110
YesCT CreditAttribution: YesCT commentedI think the next steps here are to look at comments #80 by @znerol, #100 by @neclimdul and #103 by @sun
and it needs profiling.
https://drupal.org/contributor-tasks/profiling
and
https://drupal.org/profiling
might help.
But also, exactly *what* needs profiling?
Installing drupal?
Can we link to another issue that had similar profiling done on it so we see more about how to do it?
changing to needs work to try doing some of those.
Comment #111
filijonka CreditAttribution: filijonka commentedjust a thought I got here in the evening that perhaps it's not really useful to do profiling before we actually got #80, #100, #103 cleared out. Also looking through quickly the other childissues of the same parent and couldn't find any profiling tests of them.
Maybe first step would be to remove the overrideServerVariables that is right now added in this patch and +the test?
Second would be to decide whether the class bootstrap is necessary at all, see #2016629: Refactor bootstrap to better utilize the kernel and either open anew issue for that or the named issue should take care of that?
Well that was just some thoughts.
for easier reading I hidden the non interesting patches bettwen 79 and 107.
Comment #112
sunSorry, my previous comment was terribly confused by the "bootstrap" keyword that happens to be contained in the code in this patch.
Here are some suggestions to mitigate that and improve the conversion in general:
Let's move + rename this class into
Drupal\Component\Utility\Memory
please :)
Even better:
MemoryHelper
This function/method is gone and obsolete, and thus can be removed entirely from this patch.
A
parseSize()
method on aBytes
utility class is not really self-descriptive; i.e.:- it's not clear what the input value is
- it's not clear what the output value is.
After reading up the functional code, how about this?
Bytes::toInt()
e.g.:
...seems more accurate + clear to me?
Comment #113
znerol CreditAttribution: znerol commented@YesCT (Re #107): The reroll is almost accurate, however there is an important detail missing. The problem with the systematic approach driven by solely resolving the conflicts and not touching anything else is the following: #2213643: Remove dysfunctional drupal_override_server_variables() removed a function completely from head, therefore it also needs to be removed completely from this patch. Though #107 correctly resolves the conflict in
bootstrap.inc
, it fails to reproduce the changes from #2213643 in other places (where there are no conflicts). Therefore in addition the following pieces must be removed from the patch in order to produce a correct reroll (otherwise the function and tests will be reintroduced into core and thus revert parts of #2213643):Bootstrap::overrideServerVariables()
,BootstrapTest::testOverrideServerVariables
andproviderTestOverrideServerVariables
.I realize that this reroll is not trivial and therefore I provide a reroll which I think is correct, such that the real work on this issue can continue.
Comment #114
znerol CreditAttribution: znerol commentedStill needs work (per #112), but also needs feedback from testbot.
Comment #115
filijonka CreditAttribution: filijonka commentedI was going to write additional thoughts of @suns comment but it took me some time to understand what's going on in the color.module , function color_scheme_form_submit we have now have with the latest patch:
1. $size is only used if the if-statment return true. move that into the if-statement. it' a small thing but more clear.
2. drupal_check_memory is deprecated and we should therefor use the correct way right now.
3. we don't need to have $memory_limit since if not set that is the default value in checkMemoryLimit.
so above code would be
ok so if we create a class MemoryHelper we would have Bootstrap::checkMemoryLimit and Bytes::parsesize moved to that class. so we would have MemoryHelper::checkMemoryLimit and MemoryHelper::toInt instead.
Those the code in color would be
A even nicer solution would be to have toInt function being private and let checkMemoryLimit to return the value used in the drupal_set_message. Not sure it's possible though.
Comment #116
filijonka CreditAttribution: filijonka commentedsorry I accidently removed a znerols patch
Comment #117
YesCT CreditAttribution: YesCT commentedthis is an interdiff from the just-a-strict reroll in 107 to 113. and as @znerol says in 113, work should be based off of 113.
----
(the patch in 116 is exactly the same as 113, and does not have the changes from 115).
@filijonka you can make changes you think are good, but start with 113, and then make the changes. and please provide both a new patch, and an interdiff.
[ For instructions on creating an interdiff, see https://drupal.org/documentation/git/interdiff | Microbranching workflow: http://xjm.drupalgardens.com/blog/interdiffs-how-make-them-and-why-they-... ]
Comment #118
sunI can't make sense to merging the
Bytes
andMemory
functionality into a single class.The
Bytes
functionality is used in many other contexts unrelated to memory. Just one example, in the File and Image fields, to configure and validate the maximum file upload size.Likewise, a dedicated
Memory[Helper]
class could very well be enhanced with additional memory-specific helper methods later on. — That said, we still have some other legacy functions related to PHP environment issues (e.g.,drupal_set_time_limit()
), so as a perhaps more sensible forward-looking alternative, we could name the classEnvironment
instead ofMemory
, and consolidate all those PHP environment related helper functions in there.Comment #119
filijonka CreditAttribution: filijonka commentedHi
just a thought on this issue; maybe it would be better to try to get this rtbc as it is right now and create a new issue for the remaining stuff we are discussing?
In that way we might get more people to have an opinion about the structure, names etc etc
edit:
I'm sorry if I'm messy but had a short chat with @YesCT to get some feedback and one thing was, make a big patch solving the stuff that is discussed and then we can deal with it. making smaller patches of that etc..
So I figured I better get a better grip of this patch and the issue and imho I don't think this patch is doing what it should do. I reviewed and read the summary and based on the #1938068: Convert UnitTestBase to PHPUnit it says that three things should be done:
i.e the GetFilenameUnitTest.php isn't following these guidelines as far as I can see, am I wrong?
so step one, review the patch in 116 aka 113 so we know that it at least deals with the issue and then we can do the changes too.
As soon someone has reviewed I'm going to give it a try.
Comment #120
sunHrm. We're reaching an insane amount of comments on this issue, which really ought to be a trivial conversion only.
I don't really see how this needs profiling, since there is no functional change here. The two converted helper functions are not and should not be invoked in the critical path, and even if they were, this patch only moves the procedural functions into utility classes.
Comment #121
filijonka CreditAttribution: filijonka commentedok nevermind then.
Comment #122
ParisLiakos CreditAttribution: ParisLiakos commentedPatch looks great, just one thing and its ready to go
$expected is the first argument
http://phpunit.de/manual/3.7/en/writing-tests-for-phpunit.html#writing-t...
Comment #123
sunFixed assertEquals() argument order + favor self-descriptive phpunit code instead of needless phpDoc.
Comment #124
ParisLiakos CreditAttribution: ParisLiakos commentedOh yes, +1000 for killing our custom messages, thanks!
Comment #125
YesCT CreditAttribution: YesCT commentedSorry, We dont just say "self documenting".
We still need @params.
Comment #126
YesCT CreditAttribution: YesCT commentedthis doesn't fix those @params on the test,
but it does add back the docs on the deprecated function. (those will be removed when we remove the function)
Comment #127
YesCT CreditAttribution: YesCT commentedit says here mixed, could be an int or a string. The tests though, only test a string input with units. Fix in a followup?
Comment #128
YesCT CreditAttribution: YesCT commentedadds the docs.
Comment #129
ParisLiakos CreditAttribution: ParisLiakos commentedthanks
draft change notice: https://drupal.org/node/2253127
Comment #130
filijonka CreditAttribution: filijonka commentedIf a class contains Unit in its name, remove it when converting to PHPUnit..there is no point keeping it.
Comment #131
ParisLiakos CreditAttribution: ParisLiakos commentedhmm? the tests now are named
BytesTest
andEnviromentTest
. I dont see anyUnit
in thereComment #132
filijonka CreditAttribution: filijonka commentedhow about reading what the issue is stating and not what the patch is doing?
summary says:
Task to convert
Bootstrap/GetFilenameUnitTest.php
Bootstrap/OverrideServerVariablesUnitTest.php
Bootstrap/MiscUnitTest.php
Bootstrap/ResettableStaticUnitTest.php
to phpunit.
and also read the parent issue which is stating more clearly on what and how to do it.
Comment #133
znerol CreditAttribution: znerol commentedThe issue summary (and title) needs to be updated. Also I suppose @catch might insist on getting an answer to #55 before considering to commit this.
Comment #134
damiankloip CreditAttribution: damiankloip commentedRE: #132, znerol is right, the summary is in accurate - not the patch.
RE #55/#133, The regular classloader will already be loaded by then anyway (loaded in index.php) and again in drupal_classloader(). The APC class loader is then just wrapping this?
Comment #135
catch@damiankloip, that's right, but it means that if classes are requested before the APC classloader is available, we're hitting the file system every request.
Comment #136
damiankloip CreditAttribution: damiankloip commented@catch, ah - I see your concern now. Well I think this will still happen (and is currently) as Settings will be initialized before drupal_classloader() is invoked?
Comment #137
catchYes I was thinking of a completely different issue here, this patch isn't a problem either way.
Comment #138
ParisLiakos CreditAttribution: ParisLiakos commentedComment #139
ParisLiakos CreditAttribution: ParisLiakos commentedComment #140
znerol CreditAttribution: znerol commentedAfter applying the patch
grep drupal_check_memory_limit
turns up three invocations:Also I see one invocation of
parse_size
:Those invocations should be replaced by the new component-methods.
A quick
git log -S
through the drush source-tree tells me that none of those functions were ever used in drush. Therefore we even may remove the deprecated function definitions as part of this patch. Though I do not know whether D8 contrib would be affected by that, so we also might want to leave the deprecated functions in for a moment and only remove them before release.Comment #141
damiankloip CreditAttribution: damiankloip commentedI think we need to leave the legacy procedural wrappers in place, to be removed later on.
Comment #142
sunCreated #2253915: [policy, no patch] Fix coding standards for PHPUnit tests
Comment #144
znerol CreditAttribution: znerol commentedIf anyone is going to reroll this, please make sure to replace the invocations of the deprecated functions (as described in #140).
Comment #145
ParisLiakos CreditAttribution: ParisLiakos commentedComment #147
znerol CreditAttribution: znerol commentedTypo in use statement. Same for
color.module
andsimpletest.install
Comment #148
ParisLiakos CreditAttribution: ParisLiakos commentedoops
Comment #149
znerol CreditAttribution: znerol commentedGreat!
Comment #150
catch@deprecated usage is incorrect.
Comment #151
ParisLiakos CreditAttribution: ParisLiakos commentedfixed
Comment #152
alexpottCommitted eed52b4 and pushed to 8.x. Thanks!