8000 [2.6][Translator] Extend, refactor and simplify Translator tests. by mpdude · Pull Request #14437 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[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

Closed
wants to merge 3 commits into from
Closed

[2.6][Translator] Extend, refactor and simplify Translator tests. #14437

wants to merge 3 commits into from

Conversation

mpdude
Copy link
Contributor
@mpdude mpdude commented Apr 22, 2015
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.

// 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)); }
Copy link
Contributor

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.
@mpdude
Copy link
Contributor Author
mpdude commented Apr 22, 2015

Fixed

@aitboudad aitboudad changed the title Extend, refactor and simplify Translator tests. [2.6][Translator] Extend, refactor and simplify Translator tests. Apr 22, 2015
@aitboudad
Copy link
Contributor

👍

$this->assertEquals('foobarbaz (fr.UTF-8)', $translator->trans('foobarbaz'));
$this->assertEquals('foobarbax (sr@latin)', $translator->trans('foobarbax'));
$locale = 'whatever';
$format = 'what-you-like';
Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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?

Copy link
Contributor

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 ;)

@aitboudad
Copy link
Contributor

Thank you @mpdude.

aitboudad added a commit that referenced this pull request Apr 22, 2015
…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.
@aitboudad aitboudad closed this Apr 22, 2015
@mpdude mpdude deleted the improve-translator-tests-2.6 branch April 23, 2015 05:23
Sign up for free to join this co 5AE0 nversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0