-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[2.6][Translator] Extend, refactor and simplify Translator tests. #14437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
// no assertion. this method just asserts that no exception is thrown | ||
} | ||
$this->assertEquals('OK', $translator->trans('test')); | ||
$this->assertEquals('OK', $translator->trans('test', array(), null, $locale)); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
break line before close brace
Also removes redundant tests from the TranslatorCacheTest class. In particular, the TranslatorTest already tests translations and fallbacks for a broad range of locales.
Fixed |
👍 |
$this->assertEquals('foobarbaz (fr.UTF-8)', $translator->trans('foobarbaz')); | ||
$this->assertEquals('foobarbax (sr@latin)', $translator->trans('foobarbax')); | ||
$locale = 'whatever'; | ||
$format = 'what-you-like'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind to choose a better locale and format here and in other occurrences? Closer to real life use perhaps. It doesn't read well at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand your objections. However I'd like to make it as obvious as possible which values and settings matter for a test and which do not.
For example, the TranslatorTest inside FrameworkBundle on the 2.7 branch reads fixtures from disk, so the exact locale and format names are important.
Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Choosing names like "whatever" doesn't help me to understand your point. It does look careless though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, maybe I missed that as a non-native speaker. Better now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better. I'd still prefer to see valid locale here, but I won't insist ;)
Thank you @mpdude. |
…or tests. (mpdude) This PR was squashed before being merged into the 2.6 branch (closes #14437). Discussion ---------- [2.6][Translator] Extend, refactor and simplify Translator tests. | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Fixed tickets | ~ | Tests pass? | yes | License | MIT These are the improvements from #14291 that we can easily backport to the 2.6 branch as requested [here](#14291 (comment)). Commits ------- a8c4471 [2.6][Translator] Extend, refactor and simplify Translator tests.
These are the improvements from #14291 that we can easily backport to the 2.6 branch as requested here.