/** * @test */ public function translateByIdReturnsTranslationIfOneNumericArgumentIsGiven() { $mockTranslationProvider = $this->getAccessibleMock(\TYPO3\Flow\I18n\TranslationProvider\XliffTranslationProvider::class); $mockTranslationProvider->expects($this->once())->method('getTranslationById')->with('id', $this->defaultLocale, NULL, 'source', 'packageKey')->will($this->returnValue('Translated label')); $mockFormatResolver = $this->getMock(\TYPO3\Flow\I18n\FormatResolver::class); $mockFormatResolver->expects($this->once())->method('resolvePlaceholders')->with('Translated label', array(1.0), $this->defaultLocale)->will($this->returnValue('Formatted and translated label')); $mockPluralsReader = $this->getMock(\TYPO3\Flow\I18n\Cldr\Reader\PluralsReader::class); $mockPluralsReader->expects($this->never())->method('getPluralForm'); $this->translator->injectTranslationProvider($mockTranslationProvider); $this->translator->injectFormatResolver($mockFormatResolver); $this->translator->injectPluralsReader($mockPluralsReader); $result = $this->translator->translateById('id', array(1.0), NULL, NULL, 'source', 'packageKey'); $this->assertEquals('Formatted and translated label', $result); }