Spawning an issue from
#2226533: Changes to the Language class due to the LanguageInterface (followup)
extracting all the getName() changes, for example
- $default->name = t("Site's default language (@lang_name)", array('@lang_name' => $default->name));
+ $default->setName(t("Site's default language (@lang_name)", array('@lang_name' => $default->getName())));
Comment | File | Size | Author |
---|---|---|---|
#53 | interdiff.2341341.50.53.txt | 1.6 KB | YesCT |
#53 | 2341341.53.patch | 45.21 KB | YesCT |
#50 | interdiff.2341341.49.50.txt | 910 bytes | YesCT |
#50 | 2341341.50.patch | 45.25 KB | YesCT |
#49 | 2341341-diff-46-49.txt | 1.05 KB | vijaycs85 |
Comments
Comment #1
martin107 CreditAttribution: martin107 commentedThe original patch 263.3Kbytes stripped down to 38.8Kbytes.
Which suggests it should not need to be rerolled daily.
Lets see what testbot makes of it.
Comment #3
martin107 CreditAttribution: martin107 commentedDespite my efforts to stamp it out, some changes to getName() also contained conversions of ->locked to ->isLocked()
Long story short some isLocked functions sneaked in, and caused problems.
PS I will sit on this until it goes green
Comment #4
martin107 CreditAttribution: martin107 commentedgreen :)
Comment #5
fran seva CreditAttribution: fran seva commentedAttach reroll
Comment #6
martin107 CreditAttribution: martin107 commentedThanks ... I've had a visual scan of the file....
all looks good nothing out of scope, everything appropriate.
Comment #7
YesCT CreditAttribution: YesCT commentedI'm looking at this now too. :)
Comment #8
YesCT CreditAttribution: YesCT commentedThis needs to change name on Language.
I thought maybe this issue might also need to set label property on ConfigurableLanguage to protected... but. Maybe we should do this one as two different issues. ...
Or maybe we should ... but the question is, what method would we use? the label() or getName()?
Comment #9
YesCT CreditAttribution: YesCT commentedI am about to reroll this.
Comment #10
Gábor HojtsyBetter title, tags.
Comment #11
YesCT CreditAttribution: YesCT commented(just a small note to remind myself)
using a var (and/or a type hint)
for
in LanguageSelectElementTest
would help
---
just a reroll.
next let's see what the bot says,
and also make the properties protected.
Comment #13
YesCT CreditAttribution: YesCT commentedaccidentally uploaded same one twice. I canceled one of them.
Comment #14
YesCT CreditAttribution: YesCT commentedoh, looks like I missed one. wonder why it didn't fail. maybe we are missing test coverage for it is a locked language.
at first I did
but get languages should know it is returning languages... so maybe a bit different...
yeah, I think this is better:
will do the protected next.
Comment #15
YesCT CreditAttribution: YesCT commentedand making name protected on Language.
need to think about what to do with ConfigureableLanguage.
Comment #17
YesCT CreditAttribution: YesCT commented1.
#2341313: Convert all t() calls to $this->t() in views. added a ->name direct call. found it and fixed it to getName().
2.
LanguageManager tries to rename a language object... hm.
should probably construct a new one with the new name?
3.
ContentTranslationSettingsTest
@penyaskito pointed out this might need to provide an extra method with a callback and not the property name.
4.
I'm not sure how to track down things like: Call to a member function on a non-object
Sample:
"Fatal error: Call to a member function getOption() on a non-object in /var/lib/drupaltestbot/sites/default/files/checkout/core/modules/views_ui/src/Tests/DisplayCRUDTest.php on line 141
FATAL Drupal\views_ui\Tests\DisplayCRUDTest: test runner returned a non-zero error code (255)."
maybe run the test locally and look at the trace?
Comment #19
YesCT CreditAttribution: YesCT commentedI thought maybe I could go back to a passing patch in #2226533: Changes to the Language class due to the LanguageInterface (followup) and see how this differed... but that one didn't make $name protected. :/
and good news ;) needs a reroll cause #2304403: Convert language:weight into a protected property
Comment #20
YesCT CreditAttribution: YesCT commentedjust the reroll.
Comment #22
martin107 CreditAttribution: martin107 commentedI am taking a look at this now ....
Comment #23
martin107 CreditAttribution: martin107 commentedSo here are some notes as I worked along....this is my fix for 17.2 making FilterEqualityTest.php pass.
Cloning a language and then overriding is no longer possible, as by design coders are constrained to only setting things up at construction time.
When I try to fix other issues .. from the test logs ....I see this one fix has changed the execution path through the code and many of the other errors are changed. So I want to see what testbot says now...
Comment #25
martin107 CreditAttribution: martin107 commentedFurther debugging, will happen slowly, first I need to fix this issue
#2355175: PHP Notice: Constant MENU_CALLBACK already defined when enumerating test classes
which is getting in the way.. but I will come back to this.
Comment #26
martin107 CreditAttribution: martin107 commentedNow I understand the issue filed in #25 my subconscious can ignore it when I see it..
a) Found bug identical to #23 ... and where changing the name requires the construction of a new language object ( see update.inc )
b) The next fix to LanguageConfiguration.php makes DRUPAL\CONTENT_TRANSLATION\TESTS\CONTENTTRANSLATIONSYNCIMAGETEST pass.
It was just a stray example of $language->name not converted.. to $language->getName(). I found it by web testing with backtrace 'on'
Comment #27
martin107 CreditAttribution: martin107 commentedSorry bad interdiff
Comment #28
YesCT CreditAttribution: YesCT commentedThanks. now the comment makes more sense. :)
maybe we dont need the $default right above that change either.
[edit]
this might not be so trivial as to just set the name on the new language... maybe we need to set other things it would have gotten from the getDefaultLanguage() like id (and maybe weight or direction).
this might be worth it's own little issue to fix this one test. I think we did a bunch of children out of the "Changes" issue to separate out tests that needed to be corrected before, so it wouldn't be too unusual to do that for this issue also.
Comment #30
martin107 CreditAttribution: martin107 commented@YesCT - I think that needs a little refactoring also.
I think certainly a name change as inside the 'if'
the first assignment to $default, its only purpose is to extract what I want to call $defaultName. Fixing that up In another issue ..seems best.
BUT for now I am
A) just shamelessly cherry picking some obvious bugs, which showed up now that the tests are progressing a little further..
B) While cherry picking, I noticed that $language->name is a good thing to grep for.... so I found a few more.
Comment #31
martin107 CreditAttribution: martin107 commentedYay green!
Comment #32
vijaycs85This looks wrong. We are getting default language and simply overriding with name? don't we have setName()?
Comment #33
alexpottI agree with @vijaycs85 that code block looks wrong - the default language is not necessarily the default values from new Language() - I think we need a setter for this use case of altering the default language label.
Comment #34
martin107 CreditAttribution: martin107 commentedThis is a straight reroll caused by #2340667: Protect Drupal\Core\Language\Language::id, and use getId() landing :)
I will add the setter next...
Comment #36
vijaycs85yeah, auto-merge doesn't know namespace :) added twice.
Comment #37
martin107 CreditAttribution: martin107 commented@vijaycs85 thanks. and opps :)
Comment #40
YesCT CreditAttribution: YesCT commentedwhat happened to the change to PathProcessorTest from #30 ?
(small nit, let's stick with array() syntax. #2135291: [Policy, no patch] PHP 5.4 short array syntax coding standards for Drupal 8 is not decided yet.)
Comment #41
YesCT CreditAttribution: YesCT commentedonly 2 fails and they were ..
is a random fail
#2353347: Random failure in DisplayPathTest
retesting.
Comment #43
YesCT CreditAttribution: YesCT commentedok. that is green, but I think we want the setter and to use it in update.inc
Comment #44
YesCT CreditAttribution: YesCT commentedadds the setName... to both Language and ConfigurableLanguage
thought about making a separate issue, but I think it might be ok as part of making name protected, so it's here.
not sure about the unit test, if it is the correct way to test a setter.
also I didn't add a unit test to ConfigurableLanguageUnitTest. We might need to do that. Not sure.
[edit]
I also wonder if we should put a comment on setName, and try and explain that most of the time, a language should be created with it's name passed in the constructor, and warn about when we *should* use setName()
Comment #45
YesCT CreditAttribution: YesCT commentedthis doesn't seem correct to me. Cause if the setName didn't do anything at all, it could still pass.
Comment #46
YesCT CreditAttribution: YesCT commentedwell, here is a different assert.
I'll wait for feedback.
Comment #47
vijaycs85Just one more update for setName(). Everything else looks good.
Comment #49
vijaycs85oops, syntax error. here is the correct one.
Comment #50
YesCT CreditAttribution: YesCT commentedah, good.
I'm not sure about removing that clone... but ok. (there is a comment about why in #23 where it was taken out)
In this change, I'm just making the change in update.inc more like that one in LanguageManager
I think this needs a final review and might be rtbc now. oh, wait, it needs feedback (thinking) on the unit tests on setName().
Comment #51
penyaskitoSome nitpicks...
We are missing the LanguageInterface import. Probably not in scope, however.
We don't need the variable, its value is not reused.
Same here, we don't need $name.
Comment #52
YesCT CreditAttribution: YesCT commented51.1 yeah #2226533-305: Changes to the Language class due to the LanguageInterface (followup) has some clean up that will fix that. So not doing it here.
I'll take out the $name temp var now.
Comment #53
YesCT CreditAttribution: YesCT commentedComment #54
penyaskitoRTBC then.
Comment #55
catchCommitted/pushed to 8.0.x, thanks!
Comment #57
Gábor HojtsyThanks!
Comment #58
YesCT CreditAttribution: YesCT commentedwow! super thanks to everyone. :)