getTargetBySource() 공개 메소드

Returns translated label ("target" tag in XLIFF) from source-target pair where "source" tag equals to $source parameter.
public getTargetBySource ( string $source, integer $pluralFormIndex ) : mixed
$source string Label in original language ("source" tag in XLIFF)
$pluralFormIndex integer Index of plural form to use (starts with 0)
리턴 mixed Translated label or FALSE on failure
 /**
  * @test
  */
 public function getTargetBySourceLogsSilentlyIfNoTransUnitsArePresent()
 {
     $this->mockXliffParser = $this->createMock(I18n\Xliff\XliffParser::class);
     $this->mockXliffParser->expects($this->once())->method('getParsedData')->will($this->returnValue([]));
     $mockLogger = $this->getMockBuilder(LoggerInterface::class)->disableOriginalConstructor()->getMock();
     $mockLogger->expects($this->once())->method('log')->with($this->stringStartsWith('No trans-unit elements were found'), LOG_DEBUG);
     $this->model->injectParser($this->mockXliffParser);
     $this->inject($this->model, 'i18nLogger', $mockLogger);
     $this->model->initializeObject();
     $this->model->getTargetBySource('foo');
 }