/** * @test */ public function translateByIdReturnsTranslationIfOneNumericArgumentIsGiven() { $mockTranslationProvider = $this->getAccessibleMock(XliffTranslationProvider::class); $mockTranslationProvider->expects($this->once())->method('getTranslationById')->with('id', $this->defaultLocale, null, 'source', 'packageKey')->will($this->returnValue('Translated label')); $mockFormatResolver = $this->createMock(I18n\FormatResolver::class); $mockFormatResolver->expects($this->once())->method('resolvePlaceholders')->with('Translated label', [1.0], $this->defaultLocale)->will($this->returnValue('Formatted and translated label')); $mockPluralsReader = $this->createMock(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', [1.0], null, null, 'source', 'packageKey'); $this->assertEquals('Formatted and translated label', $result); }