Looking at Drupal\node\Tests\NodeTokenReplaceTest from the perspective of #2226533: Changes to the Language class due to the LanguageInterface (followup)
This has highlighted a variable with an unfortunate variable name...
Consider this snippet of code from NodeTokenReplaceTest::testNodeTokenReplacement()
foreach ($tests as $input => $expected) {
$output = $this->tokenService->replace($input, array('node' => $node), array('langcode' => $this->languageInterface->id, 'sanitize' => FALSE));
$this->assertEqual($output, $expected, format_string('Unsanitized node token %token replaced.', array('%token' => $input)));
}
$this->languageInterface->id attempts to dynamically pull a property from a variable designated as an interface.
( Only constants can reasonably be accessed from an interface )
Other issue in the queue are trying to change this to ->id to ->getId()
see #2226533: Changes to the Language class due to the LanguageInterface (followup)
but that patch is already to unwieldy for this side issue.
I will post a patch shortly
Comment | File | Size | Author |
---|---|---|---|
#4 | languageInterface-2270339-4.patch | 10.06 KB | YesCT |
#2 | languageInterface-2270339-2.patch | 9.88 KB | martin107 |
Comments
Comment #1
martin107 CreditAttribution: martin107 commentedComment #2
martin107 CreditAttribution: martin107 commentedLocally testing of
TokenReplacementUnitTest.php AND
NodeTokenReplaceTest.php
shows both are green
For reviewing purposes I have done nothing more than a localised replacement of $languageInterface for $language.
As a relative drupal newbie can you please advise as to wheather this should have a QuickFix tag .. I would like this to be committed before its parent issue.
( I will jump on the reroll this causes )
Comment #3
YesCT CreditAttribution: YesCT commentedlooking at TokenReplaceUnitTestBase
I see the doc on that var is:
* The interface language.
so it is definitely a language and not a language interface.
I think interfaceLanguage might be a better name than just language .. if it is really the interface language (could be related to language negotiation and context stuff).
Comment #4
YesCT CreditAttribution: YesCT commentedsame patch but with interfaceLanguage
(done with a phpstorm refactor rename)
Comment #5
YesCT CreditAttribution: YesCT commentedComment #6
dawehnerperfect
Comment #7
sun+1 also makes sense to me.
Comment #8
webchickCommitted and pushed to 8.x. Thanks!
Comment #11
martin107 CreditAttribution: martin107 commented