|
@@ 208-217 (lines=10) @@
|
| 205 |
|
); |
| 206 |
|
} |
| 207 |
|
|
| 208 |
|
public function testGetTranslatedNameForcedLanguage() |
| 209 |
|
{ |
| 210 |
|
$content = $this->generateContent(); |
| 211 |
|
$this->configResolver |
| 212 |
|
->expects($this->never()) |
| 213 |
|
->method('getParameter'); |
| 214 |
|
|
| 215 |
|
$this->assertSame('My name in english', $this->translationHelper->getTranslatedContentName($content, 'eng-GB')); |
| 216 |
|
$this->assertSame('Mon nom en français', $this->translationHelper->getTranslatedContentName($content, 'eng-US')); |
| 217 |
|
} |
| 218 |
|
|
| 219 |
|
/** |
| 220 |
|
* @dataProvider getTranslatedFieldProvider |
|
@@ 225-235 (lines=11) @@
|
| 222 |
|
* @param array $prioritizedLanguages |
| 223 |
|
* @param string $expectedLocale |
| 224 |
|
*/ |
| 225 |
|
public function getTranslatedField(array $prioritizedLanguages, $expectedLocale) |
| 226 |
|
{ |
| 227 |
|
$content = $this->generateContent(); |
| 228 |
|
$this->configResolver |
| 229 |
|
->expects($this->once()) |
| 230 |
|
->method('getParameter') |
| 231 |
|
->with('languages') |
| 232 |
|
->will($this->returnValue($prioritizedLanguages)); |
| 233 |
|
|
| 234 |
|
$this->assertSame($this->translatedFields[$expectedLocale], $this->translationHelper->getTranslatedField($content, 'test')); |
| 235 |
|
} |
| 236 |
|
|
| 237 |
|
public function getTranslatedFieldProvider() |
| 238 |
|
{ |